|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Format Number and Empy Elements
Hi Guys
I still have a few problems with this. Here's my sample XML
<numbers>
<number>
<id>A</id>
<value></value>
</number>
<number>
<id>B</id>
<value>0</value>
</number>
<number>
<id>C</id>
<value>1000</value>
</number>
<number>
<id>D</id>
<value>-100</value>
</number>
<number>
<id>E</id>
<value>99.99</value>
</number>
</numbers>
RESULTS
concat('0', value) works brilliantly, except when there are negative
numbers (as I get '0-100'). There's always a catch
Strangely, sum(value[.]) still gave NaN for Element A
Here's my XSL
<!-- concat('0',value)-->
<table>
<xsl:for-each select="number">
<tr>
<td><xsl:value-of select="id"/></td>
<td align="right"><xsl:value-of
select="format-number(number(concat('0', value)), '#,.00')"/></td>
</tr>
</xsl:for-each>
</table>
<!-- sum(value[.])-->
<table>
<xsl:for-each select="number">
<tr>
<td><xsl:value-of select="id"/></td>
<td align="right"><xsl:value-of
select="sum(value[.])"/></td>
</tr>
</xsl:for-each>
</table>
Forgot to mention, I'm stuck with XSLT 1.0 (bit I guess you figured that
out)
|
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








