RE: Finding the following sibling of same type
> 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). count(following-sibling::first/preceding-sibling::*)+1 > > 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". <xsl:variable name="first-first" select="first"/> <xsl:... select="$first-first/following-sibling::*[ preceding-sibling::first is $first-first]"/> "is" is an XPath 2.0 operator to test node-identity; in XPath 1.0 replace "A is B" by "generate-id(A) = generate-id(B)". Michael Kay
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