Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XSLT for-each get previous item >Thread Next - Re: XSLT for-each get previous item Re: XSLT for-each get previous itemTo: NULL Date: 2/5/2009 8:39:00 PM On Feb 6, 6:00=A0am, DustWolf <jure....@bia.si> wrote:
> =A0 =A0<xsl:for-each select=3D"/values/value">
> =A0 =A0 <item last=3D"{/values/value[position()-1]}" current=3D"{.}" />
> =A0 =A0</xsl:for-each>
>
> ...unfortunately since position() always gives the position within the
> current context, it returns the position within /values/value (which
> is always 1), instead of my for-each loop.
you should be able to do this by using a variable,
<xsl:for-each select=3D"/values/value">
<xsl:variable name=3D"pos" select=3D"position()" />
<item last=3D"{/values/value[$pos-1]}" current=3D"{.}" />
</xsl:for-each>
This is not tested though.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
