Convert Negative to Positive
Posted: Thu Jan 12, 2023 10:16 pm
Hello all,
Using XSLT to translate an incoming cXML OrderRequest transaction to an outgoing proprietary format for B to B eprocurement purchasing flow. My scenario is as follows. Any suggestions would be appreciated. Thanks!
In the incoming cXML OrderRequest we have a dollar amount being passed to us as a negative value:
<ItemFees>
<Fee>
<Type>Commission</Type>
<Amount currency="USD">-4.11</Amount>
</Fee>
</ItemFees>
I am mapping to that fee and passing it in the outgoing format in an Extrinsic line:
<Extrinsic name="54">-4.11</Extrinsic>
What I need to do is convert the negative value to a positive value by simply removing the dash "-" before the dollar amount. I've tried several things but can't get it to work.
My current XSLT config is as follows. Anyone know if there is a way in this command structure to remove that dash, or tell it to convert it to a positive value?
<Extrinsic name="54">
<xsl:value-of select="OrderReport/Item/ItemFees/Fee/Amount"/>
</Extrinsic>
Using XSLT to translate an incoming cXML OrderRequest transaction to an outgoing proprietary format for B to B eprocurement purchasing flow. My scenario is as follows. Any suggestions would be appreciated. Thanks!
In the incoming cXML OrderRequest we have a dollar amount being passed to us as a negative value:
<ItemFees>
<Fee>
<Type>Commission</Type>
<Amount currency="USD">-4.11</Amount>
</Fee>
</ItemFees>
I am mapping to that fee and passing it in the outgoing format in an Extrinsic line:
<Extrinsic name="54">-4.11</Extrinsic>
What I need to do is convert the negative value to a positive value by simply removing the dash "-" before the dollar amount. I've tried several things but can't get it to work.
My current XSLT config is as follows. Anyone know if there is a way in this command structure to remove that dash, or tell it to convert it to a positive value?
<Extrinsic name="54">
<xsl:value-of select="OrderReport/Item/ItemFees/Fee/Amount"/>
</Extrinsic>