422,754 Members | 2,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,754 IT Pros & Developers. It's quick & easy.

Trying to use xslt to move the decimal and remove the extra 0s

100+
P: 153
Hi so I have these 2 values in the incoming xml

<Value1>1800000</Value1>
<Value>385000</Value>

I am trying to transform this format to the following
<DATA>180.00</DATA>
<DATA>38.50</DATA>

I attempted to use the following
<xsl:decimal-format name="dollars" decimal-separator="." grouping-separator=","/>

<xsl:value-of select="format-number(OrderQuantity/Quantity/Number/Value1,'###.#####', 'dollars')"/>

<xsl:value-of select="format-number(OrderQuantity/Quantity/Number/Value,'###.#####', 'dollars')"/>

I tried different combinations with the hash but no luck.
Any help would be greatly appreciated.
Feb 25 '18 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 921
"trying to move the decimal"
that sounds like "dividing by 10"

something (untested, because I do know nothing about XSLT
Expand|Select|Wrap|Line Numbers
  1. <xsl:value-of select="format-number(OrderQuantity/Quantity/Number/Value div 10000,'###.#####', 'dollars')"/>
Feb 25 '18 #2

100+
P: 153
That helped i was only thinking of using the built in function with the decimals. That was a good idea and it worked. Thanks

Expand|Select|Wrap|Line Numbers
  1. <xsl:value-of select="format-number(GrossPrice/MonetaryValue/Number/Value div 10000., '0.00')"/>
Feb 27 '18 #3

Post your reply

Sign in to post your reply or Sign up for a free account.