|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Preceding-sibling in for-each
Hi Andrew,
> How I can get "preceding-sibling" node in for-each flow:
>
> <xsl:for-each select="//some-node">
> <xsl:value-of select="*[position()-1]"/>
> </xsl:for-each>
>
> seems not work.
If I interpret you correctly, you can do something like:
<xsl:variable name="nodes" select="//some-node" />
<xsl:for-each select="$nodes">
<xsl:variable name="pos" select="position()" />
<xsl:value-of select="$nodes[$pos - 1]" />
</xsl:for-each>
But it's very inefficient and I doubt that it's the best way to
achieve what you want to achieve. If you told us what you're trying to
do (what your source and desired result is) we might be able to show
you a better approach.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
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








