xsl-list
[Top] [All Lists]

Ignoring sibling parents

2003-05-06 08:58:18
Hi all,

I find that I am unable to select the sibling information for siblings that
don't share the same parents. I use the following XPath statement, well
similar anyway, to return the sibling id, and it performed perfectly until I
encountered siblings with different parents:

        foobar/foo[(_at_)id=2]/following-sibling::foo[1]/@id
        foobar/foo[(_at_)id=2]/preceding-sibling::foo[1]/@id


Original data:
<foobars>
        <foobar>
                <foo id="1" />
                <foo id="2" />
                <foo id="3" />
                <foo id="4" />
        </foobar>
</foobars>

But my problem occurred when I started receiving data like this, since I
still wanted to pick up <foo id="3"> id attribute:
<foobars>
        <foobar>
                <foo id="1" />
                <foo id="2" />
        </foobar>
        <foobar>
                <foo id="3" />
                <foo id="4" />
        </foobar>
</foobars>


I don't get anything even if I precede my XPath expressions above with
foobars/. Any suggestions?


Kaine


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>