Note that there are some explanatory texts on larger screens.

plurals
  1. POXPath: Get value of last sibling in a node
    primarykey
    data
    text
    <p>I am trying to create an XPath expression for use in MS InfoPath in order to retrieve the value of the last sibling in a node. (Hopefully I am phrasing this question correctly as I've barely ever used XPath).</p> <p>I need to identify the most recent instance of the "NamesEval" node inside the "RepeaterGroup" node. Hypothetically I will be looking to see if "Steve" is attending the latest event; I will check for this using a <code>contains(LatestEvent, "Steve")</code> XPath expression. How do I get "LatestEvent" to load in only the most recent "NamesEval" value?</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;?mso-infoPathSolution solutionVersion="1.0.0.2" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Documents%20and%20Settings\Chris\Local%20Settings\Application%20Data\Microsoft\InfoPath\Designer3\db543e141b8f4832\manifest.xsf" ?&gt;&lt;?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?&gt;&lt;my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-09-07T14:19:10" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us"&gt; &lt;my:InitialSection&gt; &lt;my:InitialField&gt;1&lt;/my:InitialField&gt; &lt;my:InitialDate&gt;2012-09-14&lt;/my:InitialDate&gt; &lt;/my:InitialSection&gt; &lt;my:RepeaterSection&gt; &lt;my:RepeaterGroup&gt; &lt;my:RepeaterField&gt;2&lt;/my:RepeaterField&gt; &lt;my:RepeaterDate&gt;2012-09-15&lt;/my:RepeaterDate&gt; &lt;my:NamesGroup&gt; &lt;my:NamesRepeater&gt; &lt;my:Name&gt;Steve&lt;/my:Name&gt; &lt;/my:NamesRepeater&gt; &lt;my:NamesRepeater&gt; &lt;my:Name&gt;Ashley&lt;/my:Name&gt; &lt;/my:NamesRepeater&gt; &lt;my:NamesRepeater&gt; &lt;my:Name&gt;Josh&lt;/my:Name&gt; &lt;/my:NamesRepeater&gt; &lt;/my:NamesGroup&gt; &lt;my:NamesEval&gt;Steve;Ashley;Josh;&lt;/my:NamesEval&gt; &lt;/my:RepeaterGroup&gt; &lt;my:RepeaterGroup&gt; &lt;my:RepeaterField&gt;3&lt;/my:RepeaterField&gt; &lt;my:RepeaterDate&gt;2012-09-16&lt;/my:RepeaterDate&gt; &lt;my:NamesGroup&gt; &lt;my:NamesRepeater&gt; &lt;my:Name&gt;Amanda&lt;/my:Name&gt; &lt;/my:NamesRepeater&gt; &lt;my:NamesRepeater&gt; &lt;my:Name&gt;Greg&lt;/my:Name&gt; &lt;/my:NamesRepeater&gt; &lt;my:NamesRepeater&gt; &lt;my:Name&gt;Steve&lt;/my:Name&gt; &lt;/my:NamesRepeater&gt; &lt;/my:NamesGroup&gt; &lt;my:NamesEval&gt;Amanda;Greg;Steve;&lt;/my:NamesEval&gt; &lt;/my:RepeaterGroup&gt; &lt;/my:RepeaterSection&gt; </code></pre> <p></p> <p><strong>EDIT &amp; ANSWER</strong></p> <p>Choroba answered the question below - here is the solution: <code>//my:RepeaterGroup[0=count(following-sibling::my:RepeaterGroup)]//my:NamesEval</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload