Always return element value from current node with XPath

bigdm

New Member
I need an XPath expression that returns the current \[code\]Line_Item_Mod_0\[/code\] value within each node in order to conditionally format an MS InfoPath form. I'm quite green to XPath and I don't know what the appropriate term for this behavior (exhibited by an expression) is. Here is my XML:\[code\]<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.504" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Documents%20and%20Settings\Chris\Local%20Settings\Application%20Data\Microsoft\InfoPath\Designer3\c37482678ae440c9\manifest.xsf" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?><?mso-infoPath-file-attachment-present?><my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-05-05T19:56:08" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us"><my:MasterSection> <my:Project_Information> <my:Line_Items> <my:Counter>1</my:Counter> <my:Authorized_Number>4</my:Authorized_Number> <my:XPathLINCounter>Line Item 1</my:XPathLINCounter> <my:Line_Item_Mod_0>false</my:Line_Item_Mod_0> </my:Line_Items> <my:Line_Items> <my:Counter>2</my:Counter> <my:Authorized_Number>7</my:Authorized_Number> <my:XPathLINCounter>Line Item 2</my:XPathLINCounter> <my:Line_Item_Mod_0>true</my:Line_Item_Mod_0> </my:Line_Items> <my:Line_Items> <my:Counter>3</my:Counter> <my:Authorized_Number>2</my:Authorized_Number> <my:XPathLINCounter>Line Item 3</my:XPathLINCounter> <my:Line_Item_Mod_0>false</my:Line_Item_Mod_0> </my:Line_Items> </my:Project_Information></my:MasterSection></my:myFields>\[/code\]I am trying to evaluate whether the "mod" value for the current node is 1 or 0. I already have an expression that does this, but for some reason InfoPath conditional formatting doesn't like it. You can see the results of this mod expression in the \[code\]Line_Item_Mod_0\[/code\] element.All I need to do is target the \[code\]Line_Item_Mod_0\[/code\] element within each \[code\]Line_Items\[/code\] node. I can't seem to make an expression that returns the value of the \[code\]Line_Item_Mod_0\[/code\] for its parent node (or perhaps "current" is the correct term).I.E. \[code\]Line_Items\[/code\] node 1 would have an expression within it that ALWAYS returns the \[code\]false\[/code\] value of \[code\]Line_Item_Mod_0\[/code\].I realize this should be simple, but I can't seem to get my expression to stick within its current node.The expression \[code\](count(preceding-sibling::my:*) + 1) mod 2 > 0\[/code\] generates the \[code\]Line_Item_Mod_0\[/code\] node but doesn't play nice with conditional formatting if I apply it as a rule. I can't tell why.I want to try to bypass it and evaluate the "true" or "false" value directly.
 
Back
Top