Re: grouping-separaor => problems

Axel Hecht <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Pascal Sartoretti wrote:
> Hello,
> 
> I would like an integer like "123456789" to be formatted as 
> "123'456'789" (why? because it is the usual format in Switzerland).
> 
> This leads to problems with Mozilla FireFox, as can be seen in the 
> following test case:

Actually, you have that problem in all processors, just that others give 
better error messages here. Though not good ones, it took me a bit to 
find out what happened.
> 
> I think that the problem probably comes from the fact that I try to use 
> a ' as separator, which is a special XML character.
> 
> Can somebody help me?
> 

Actually, you have to use the right group separator in the function 
call, too. The following works:

<?xml version="1.0"?>
<xsl:stylesheet
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       version="1.0">
    <xsl:decimal-format name="myFormat" grouping-separator="'"/>
    <xsl:template match="/data">
        <HTML>
          <BODY>
             <xsl:value-of 
select="format-number(number,&quot;###&apos;###&apos;###&quot;, 
'myFormat')"/>
          </BODY>
        </HTML>
    </xsl:template>
</xsl:stylesheet>


Note that I used entities to get around the quoting mess in the end ;-)

Axel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.