Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: 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/7/2009 8:39:00 AM Hi,
On 6 feb., 05:39, Mukul Gandhi <gandhi.mu...@gmail.com> wrote:
> you should be able to do this by using a variable,
>
> <xsl:for-each select=3D"/values/value">
> =A0 <xsl:variable name=3D"pos" select=3D"position()" />
> =A0 <item last=3D"{/values/value[$pos-1]}" current=3D"{.}" />
> </xsl:for-each>
>
> This is not tested though.
It works (interestingly, as I found answers all over the web
specifically stating that this could not be done, e.g. that an XSLT
variable is actually a constant which's value cannot be changed once
defined), but I needed to insert a space between "$pos" and "-1" as
otherwise the variable name would be interpreted as "pos-1", which is
not defined.
Thanks!
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
