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: How to assign a value and reuse a global variable


>What I am trying to is this.
>At the very top level of my xsl doc I a declare an empty variable with no values
>like this
>
><xsl:variable name ="monday"/>
>
Strictly speaking this gives you a variable whose value is an empty
string - not quite the same thing as 'no value'.

>now in my temlates at run time I want to assign this variable a value of 
>
><xsl:variable name = "$monday" select = "'Monday'"/>
>
There is no assignment statement in XSLT.  What you are doing is
creating a *new* variable whose name is $monday (rather than simply
monday).  $monday is not a legal variable name, so your processor
should be signalling an error.

>Now first of all is it possible to do?If it is then is my syntactic approach
>is valid,and if it is then how come I don't see the value I set for monday :-)
>
It depends what you are trying to do.  It may be as simple as putting
<xsl:variable name = "monday" select = "'Monday'"/>

(in which case the top level declaration is probably unnecessary).

If not, you will need to tell us what your stylesheet is trying to
achieve.

Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@melvaig.co.uk

 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]