RE: [xsl] setting variables in xslt

Subject: RE: [xsl] setting variables in xslt
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 21 Nov 2002 17:40:09 -0000
> 
> 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: [xsl] 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: [xsl] 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