Altova Mailing List Archives


Re: Variables in XSLT

From: Wizfrog <googleaccount@-------.--->
To: NULL
Date: 7/13/2007 10:15:00 PM

On Jul 13, 8:55 pm, Joe Kesselman <keshlam-nos...@comcast.net> wrote:
> XSLT variables are single-assignment. You can't change them once they've
> been set. The closest you can come is to create a new instance in a new
> scope.
>
> Generally the right thing to do is to rewrite to avoid the need. In the
> few cases where you can't, recursion can be used in place of looping,
> but that has serious efficiency issues and should generally be
> considered a last resort.
>
> --
> () ASCII Ribbon Campaign  | Joe Kesselman
> /\ Stamp out HTML e-mail! | System architexture and kinetic poetry

One thing I have used if you want to generate 0 or 1 kind of trigger,
is use the position() function with modulo:

<xsl:when test="position() mod(2) = 0"> do this</
xsl:when><xsl:otherwise> do that</xsl:otherwise></xsl:choose>

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.