Subject: Re: [xsl] Set variable via contents of <variable> element|
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 17 Dec 2009 14:38:09 +0100
As I understand it, I can set the value of a variable in two ways: 1. By the "select" attribute of the <variable> element: <xsl:variable name="myvariable" select="'myvalue'"/>
2. By the contents of the <variable> element: <xsl:variable name="myvariable"> My value </xsl:variable>
The reason I need to do this is because I want to set the variable 'usethis' to the result of a <choose> element which (as far as I know) I cannot include in a "select" attribute. Also in my real example 'this' is a parameter.
With 2.0, are you aware of the XPath 2.0 if (condition) then expression1 else expression2 conditional expression that might help to use <xsl:variable name="myvariable" select="if (someCondition) then foo else bar"/> to use the select attribute.
Martin Honnen http://msmvps.com/blogs/martin_honnen/