This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: passing arguments in the xml-stylesheet line



Garrick,

This is another one of those XSL beginner FAQs...

The short answer is that you cannot change the value of a <xsl:variable>
once you create it. Perhaps the XSLT designers should not have called it a
"variable" since it's value doesn't really "vary".  But it's much too late
for that debate now.

Depending on your exact circumstances, you can sometime "over-ride" a
variable:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl
="http://www.w3.org/1999/XSL/Transform";>
   <xsl:variable name="foo" select="'bar'" />
   <xsl:template match="/">
     <root>
       <xsl:value-of select="$foo" />
       <inner>
        <xsl:variable name="foo" select="'baz'" />
        <xsl:value-of select="$foo" />
       </inner>
    </root>
   </xsl:template>
</xsl:stylesheet>

Inside the <inner> node, the value of $foo becomes 'baz', while anywhere
else in the stylesheet, it remains 'bar'.

I hope that this helps

Dave

Date: Fri, 7 Dec 2001 11:56:42 +0530
From: "Garrick Besterwitch" <garrickb@infonox.com>
Subject: Re: [xsl] passing arguments in the xml-stylesheet line

Hi ,

  I have a globle variable defined at the top of my xsl file....
How do I change the value of this variable  based on some condition inside
a
template????.

Thanks
Garrick



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]