|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Finding the following sibling of same type
Hi,
I have an XML document that has the following sequence in it :
<main>
<first>.....</first>
<second>....</second>
<third>....</third>
<second>...</second>
<third>....</third>
<first>....</first>
<second>....</second>
</main>
If I am on the first "first" element node, how can I write an
XPath expression to get the position of the second instance of the
"first" element? I can write
followin-sibling::first[position() = 1]
....to locate the element, but I'm having trouble figuring out how to
find its position within the parent (main). The trouble appears to be
that if I put the above XPath expression with in the select of a
for-each, then, within the context of that for-each, the position of
the next "first" node is = 1. Somehow, I need to figure out how to
shift the context to the parent node, but an xsl:for-each select="../"
doesnt seem to solve my problem, because then I dont know how to test
for node equality between the children of the parent and the node that
I'm interested in. Any ideas?
Actually, the real problem is for me to write an XPath expression
that will select all children of "main" from the first "first" upto
(but exluding) the next "first". Hence my desire to locate the
position of the next "first".
Thanks,
Kenneth
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








