[XSLT] formater un nombre
Bonjour,
Je deviens de nouveau taré avec mes nombres je sais pas pourquoi mais ce nombre ne se format pas comme je le souhaite et je ne comprend pas trop pourquoi:
Mon xslt:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="Stueckelung">
<xsl:variable name="apos">'</xsl:variable>
<w:p>
<w:pPr>
<w:keepNext/>
<w:keepLines/>
</w:pPr>
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>
<xsl:number value="@Anzahl" grouping-separator="'" format="1" grouping-size="3"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@Aktien"/> zu CHF <xsl:choose>
<xsl:when test="contains(@AktienWert, '.')">
<xsl:value-of select="translate(format-number(@AktienWert, '###,###.##'), ',', $apos)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="translate(format-number(@AktienWert, '###,###'), ',', $apos)"/>.--</xsl:otherwise>
</xsl:choose>
</w:t>
</w:r>
</w:p>
</xsl:template>
</xsl:stylesheet> |
mon XML :
Code:
1 2 3 4
| <?xml version="1.0" encoding="UTF-8"?>
<Stueckelung Aktien="Namenaktien" AktienTyp="ZNA" AktienWert="0.80" Anzahl="1183046764" Waehrung="CHF" valid="1">
<Stueck>1'183'046'764 Namenaktien zu CHF 0.80</Stueck>
</Stueckelung> |
ma sortie:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <?xml version="1.0" encoding="UTF-8"?>
<w:p xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<w:pPr>
<w:keepNext />
<w:keepLines />
</w:pPr>
<w:r>
<w:rPr>
<w:b />
</w:rPr>
<w:t>1'183'046'764 Namenaktien zu CHF .8</w:t>
</w:r>
</w:p> |
ce que j'aimerais:
Code:
1 2 3
| ...
<w:t>1'183'046'764 Namenaktien zu CHF 0.80</w:t>
... |
Comment faire?
Merci de votre aide!
++
Thierry