XPath: Get value of last sibling in a node

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).

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 contains(LatestEvent, "Steve") XPath expression. How do I get "LatestEvent" to load in only the most recent "NamesEval" value?

 <?xml version="1.0" encoding="UTF-8"?><?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" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?><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">
<my:InitialSection>
    <my:InitialField>1</my:InitialField>
    <my:InitialDate>2012-09-14</my:InitialDate>
</my:InitialSection>
<my:RepeaterSection>
    <my:RepeaterGroup>
        <my:RepeaterField>2</my:RepeaterField>
        <my:RepeaterDate>2012-09-15</my:RepeaterDate>
            <my:NamesGroup>
                <my:NamesRepeater>
                    <my:Name>Steve</my:Name>
                </my:NamesRepeater>
                <my:NamesRepeater>
                    <my:Name>Ashley</my:Name>
                </my:NamesRepeater>
                <my:NamesRepeater>
                    <my:Name>Josh</my:Name>
                </my:NamesRepeater>
            </my:NamesGroup>
        <my:NamesEval>Steve;Ashley;Josh;</my:NamesEval>
    </my:RepeaterGroup>
    <my:RepeaterGroup>
        <my:RepeaterField>3</my:RepeaterField>
        <my:RepeaterDate>2012-09-16</my:RepeaterDate>
        <my:NamesGroup>
            <my:NamesRepeater>
                <my:Name>Amanda</my:Name>
            </my:NamesRepeater>
            <my:NamesRepeater>
                <my:Name>Greg</my:Name>
            </my:NamesRepeater>
            <my:NamesRepeater>
                <my:Name>Steve</my:Name>
            </my:NamesRepeater>
            </my:NamesGroup>
        <my:NamesEval>Amanda;Greg;Steve;</my:NamesEval>
    </my:RepeaterGroup>
</my:RepeaterSection>

EDIT & ANSWER

Choroba answered the question below - here is the solution: //my:RepeaterGroup[0=count(following-sibling::my:RepeaterGroup)]//my:NamesEval

Answers


I am not sure I understand your question. If you are trying to verify that the last NamesEval contains the string "Steve", you can use the following XPath expression:

contains((//my:NamesEval)[last()],'Steve')

Need Your Help

Internal Server Error 500 in Mongod for Python code

python mongodb bottle

I am taking the MongoDB m101p course and I run into trouble;

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.