xsl-list
[Top] [All Lists]

RE: setting variables in xslt

2002-11-21 03:37:24
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>.

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(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of 
Michael Kay
Sent: 21 November 2002 13:10
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com



-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Stevenson Ngila
Sent: 21 November 2002 08:29
To: Xsl-List(_at_)Lists(_dot_) 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



<Prev in Thread] Current Thread [Next in Thread>