Re: [xsl] setting variables in xslt

Subject: Re: [xsl] setting variables in xslt
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 21 Nov 2002 11:16:21 GMT

> what i want to do is: <xsl:when test="$iTimeZoneOffset= '-1'">, set
> $iTimeZoneOffset to be $iCurrentOffset,

But you've been on this list long enough to have seen 10001 messages
telling you that you can not change the value of a variable once it is
bound. 

If $iTimeZoneOffset is -1 then you can not chage its value to be
anything else.

If it is a parameter to a template you can call teh template passing a
new value as parameter.


> the first time using $iCurrentOffset and the second time using
> $iTimeZoneOffset

so make all of that code a named template with a parameter offset
then call it once with  offset set to $iCurrentOffset and once with
offset set to $iTimeZoneOffset.

Of if you don't actually need to call it twice but just want to
call it once, but with a value thatdepends on some condition, change the
code to use $offset insetaed of $iCurrentOffset then before you execute
that block do 

<xsl:variable name="offset">
<xsl:choose>
  <xsl:when .....>
    <xsl:value-of select="$iCurrentOffset"/>
  </xsl:when>
  <xsl:otherwise>
      <xsl:value-of select="$iTimeZoneOffset"/>
 </xsl:otherwise>
<xsl:choose>
</xsl:variable>

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread