Page 1 of 1

Output currency sings (pounds,yen,euros) with xslt? help!

Posted: Fri Jun 29, 2007 7:14 pm
by peppino
i can not figure out how to output currency signs with xslt. i mainly want to output the pound currency sign.

The user types in the currency sign they want to use and then all prices should be displayed with that currency sign next to it.

First off, how should the user enter the pound sign? do they need to enter the encoded version or can the enter the character itself.

Im trying to access this currency value like this

Code: Select all

<xsl:value-of select="$currencysign" disable-output-escaping="yes"/>
Can anyone help me figure out how to get this working?

Posted: Mon Jul 02, 2007 11:17 am
by sorin_ristache
Hello,

If you want to output the currency characters euro, pound, etc the output encoding of the XSLT stylesheet should contain them. For example the UTF-8 encoding contains them and if your stylesheet declares UTF-8 as output encoding you can just insert currency characters in the output:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="UTF-8"/>

<xsl:template match="/">
<xsl:variable name="euro">€</xsl:variable>
<xsl:variable name="pound">£</xsl:variable>

<xsl:value-of select="$euro"/>
<xsl:value-of select="$pound"/>
</xsl:template>
</xsl:stylesheet>

Regards,
Sorin