XPath for choosing a sibling after
        Posted  
        
            by 
                Arsen Zahray
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Arsen Zahray
        
        
        
        Published on 2012-09-08T21:07:47Z
        Indexed on 
            2012/09/08
            21:38 UTC
        
        
        Read the original article
        Hit count: 211
        
I've got following xml:
<root>
    <a>value1</a>
    <b>value2</b>
    <c>value3</c>
    <a>value5</a>
    <d>value4</d>
    <b>value2</b>
    <b>value3</b>
    <a>value7</a>
</root>
I want to select the first sibling a after node //b[text()='value2'] if it's not followed by an other b-node (in this case it will be <a>value5</a>, <a>value7</a> should not be selected).
What's the xpath to do that?
I'm using .net 4 and xpath 1.0
© Stack Overflow or respective owner