[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Preceding siblings test
Hintz, David wrote:
I'm still a novice at XSLT and am having a problem coming up with a test for elements preceding a particular element, but only up to the first occurrence of the same (or parent) element. For example, in this XML: With XSLT 2.0 you can use the XPath 2.0 '>>' operator <xsl:template match="item"> <xsl:variable name="preceding-item" select="preceding-sibling::item[1]"/> <xsl:variable name="preceding-abs" select="preceding-sibling:a[. >> $preceding-item] | preceding-sibling:b[. >> $preceding-item]"/> </xsl:template> It sounds however as if you might want to consider <xsl:for-each-group select="*" group-ending-with="item"> in a template matching the "list" element. That's also XSLT 2.0 however. -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|
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
|