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

Here should go questions about transforming XML with XSLT and FOP.
peppino
Posts: 1
Joined: Fri Jun 29, 2007 7:10 pm

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

Post 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?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Post Reply