[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: setting variables in xslt

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

> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.