Reputation: 1
I'm new to XSL and looking for help on returning an absolute value for the following:
xsl:value-of select="inr:distanceFormat(number(@firstOffset), $xslDistancePrecision)"/>
I know someone has posted $vNum*($vNum >=0) - $vNum*($vNum < 0)
but I cant get it to work, any help?
Do I substitute all the inr:distanceFormat(number(@firstOffset), $xslDistancePrecision)
for Num
in the absolute formula?
Thanks Drumdivan
Upvotes: 0
Views: 1099
Reputation: 163458
Simplest (not necessarily fastest) is probably just to strip any minus sign from the string representation: number(translate(string(xxx), '-', ''))
Upvotes: 1
Reputation: 167696
Define a variable
<xsl:variable name="vNum" select="inr:distanceFormat(number(@firstOffset), $xslDistancePrecision)"/>
then use the suggestion <xsl:value-of select="$vNum*($vNum >=0) - $vNum*($vNum < 0)"/>
.
Upvotes: 0