[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: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 21 Nov 2002 17:40:09 -0000
xslt setting variables
> 
> what i want to do is: <xsl:when test="$iTimeZoneOffset= 
> '-1'">, set $iTimeZoneOffset to be $iCurrentOffset, since the 
> operation in the <xsl:when> statement is also been repeated 
> in <xsl:otherwise>.

Tell us about the input of your stylesheet and the output you want to
produce.

Don't tell us about the code you want to write, because you can't do it
in the procedural way you are thinking about it.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 



> 
> This will help me optimise my code
> 
> what is been repeated is:
> 
> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
> <><><><><><><>
> <><><><><><><><><><><><><><><><><><><><><><><><>
> 	<xsl:choose>
> 		    <xsl:when test="$iHour &lt; $iTimeZoneOffset ">
> 			    <xsl:value-of select="($iDate - 
> 1)"/><xsl:value-of select="$iMonthYear"/>, <xsl:value-of 
> select="($iHour + 24) - $iTimeZoneOffset"/><xsl:value-of 
> select="$iMinutes"/>
> 		    </xsl:when>
> 		    <xsl:otherwise>
> 			    <xsl:value-of 
> select="$iDate"/><xsl:value-of select="$iMonthYear"/>,
> 			    <xsl:choose>
> 				<xsl:when test="$iHour &lt; '10'">
> 					0<xsl:value-of 
> select="$iHour - $iTimeZoneOffset"/>
> 				</xsl:when>
> 				<xsl:otherwise>
> 					<xsl:value-of 
> select="$iHour - $iTimeZoneOffset"/>
> 				</xsl:otherwise>
> 			    </xsl:choose>
> 			    <xsl:value-of select="$iMinutes"/>
> 		    </xsl:otherwise>
> 		</xsl:choose>
> 	    </xsl:otherwise>
>     </xsl:choose>
> 
> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
> <><><><><><><>
> <><><><><><><><><><><><><><><><><><><><><><><><>
> the first time using $iCurrentOffset and the second time 
> using $iTimeZoneOffset. But with setting $iTimeZoneOffset to 
> be $iCurrentOffset, i will only have to write the above code once.
> 
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
> Sent: 21 November 2002 13:10
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  setting variables in xslt
> 
> 
> You can't modify variables in XSLT, it is a declarative language.
> 
> This is a FAQ, and the answer is always the same: tell us 
> what problem you are trying to solve, so we can tell you how 
> you should be tackling it.
> 
> Michael Kay
> Software AG
> home: Michael.H.Kay@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx
> 
> 
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Stevenson 
> > Ngila
> > Sent: 21 November 2002 08:29
> > To: Xsl-List@Lists. Mulberrytech. Com
> > Subject:  setting variables in xslt
> >
> >
> > if i have:
> >
> > <><><><><><><><><><><><><><><><><><><><><><><><>
> >  <xsl:when test="$iTimeZoneOffset= '-1'">
> >
> > </xsl:when>
> > <><><><><><><><><><><><><><><><><><><><><><><><>
> >
> > how can i set $iTimeZoneOffset to another variable say 
> iCurrentOffset
> >
> >
> > Thanks,
> > Stevenson Ngila
> > Footman-Walker Associates Ltd
> > http://www.footman-walker.co.uk
> >
> >
> >
> >
> >  XSL-List info and archive:  
> http://www.mulberrytech.com/xsl/xsl-list
> >
> >
> 
> 
>  XSL-List info 
> and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.