gyanendra
gyanendra

Reputation: 53

Declare a empty variable

I wrote :-

<xsl:variable name="cAddress" select=""></xsl:variable> 

I don't want to assign any value here, I want to assign later. Is this possible?

Upvotes: 0

Views: 4461

Answers (1)

michael.hor257k
michael.hor257k

Reputation: 117102

No it is not possible. In XSLT, variables are immutable. You cannot assign - or reassign - a value to an existing variable. Technically, you can declare an empty variable as:

<xsl:variable name="myVar"/>

but you won't be able to do anything with it later.


If you want to pass a parameter to a stylesheet or to a template at runtime, use:

<xsl:param name="cAddress"/>

or:

<xsl:param name="cAddress" select="'default value'"/>

Upvotes: 1

Related Questions