Hello,
XSLT 1.0 (e.g. Firefox 3.0, etc.)
I have a template as follows:
<xsl:template name="getCurrencySymbol">
<xsl:param name="aCurrency" />
<xsl:choose>
<xsl:when test="$aCurrency='AUD'">A$</xsl:when>
<xsl:when test="$aCurrency='EUR'">€</xsl:when>
<xsl:when test="$aCurrency='GBP'">£</xsl:when>
<xsl:when test="$aCurrency='NZD'">NZ$</xsl:when>
<xsl:when test="$aCurrency='USD'">US$</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:template>
At the top of my xsl stylesheet I want to put its value into a global
variable:
<xsl:variable name="theCurrencySymbol">
<xsl:call-template name="getCurrencySymbol">
<with-param name="aCurrency" select="'NZD'" />
</xsl:call-template>
</xsl:variable>
But this does not work. Mangano (2003, p.120) shows that it will work if
the template is called _without_ a parameter, and indeed I am able to do
so successfully if I use a global variable, e.g. $baseCurrency, and
change my getCurrencySymbol template so that it uses $baseCurrency (i.e.
ignoring the $aCurrency parameter).
The problem is that I would like to be able to re-use my
getCurrencySymbol template elsewhere, but with a specified parameter in
its call rather than a global.
Is it really not possible to put the result of a template into a
variable, if that template is being called using a parameter? I cannot
think why such a minor distinction would be in the language.
Cheers!
Joe
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--