|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: preceding-sibling inside for-each appears to fail
Hi Ted,
Ted Stresen-Reuter wrote: ... <p>preceding sibling = <xsl:value-of select="preceding-sibling::attribute/@name" /></p> ... As you can see, following-sibling successfully returns the following sibling, but preceding-sibling always returns the first node rather than the preceding-sibling node. You need to remember two things here. First, XPath expressions normally return node-sets. Second, node-sets are processed in document order. So your select expression is returning the first member of the set "preceding-sibling::attribute/@name", which is always the first in document order. But if you put a positional predicate in as part of an XPath step then that is applied in the order of the current axis, so try <p>preceding sibling = <xsl:value-of select="preceding-sibling::attribute[1]/@name" /></p> Hope this helps - Francis. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








