|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Parameters into variables
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








