Re: [xsl] A - B

Subject: Re: [xsl] A - B
From: pcoustillas <pcoustillas@xxxxxxxxxxx>
Date: Mon, 26 Aug 2002 09:14:17 +0200
 thanks, but if i have this XML :
<A>37</A>
<B/>

and my XSL :
<xsl:decimal-format NaN="0" name="forme1" decimal-separator="," grouping-separator=" " />


the result is 0 but i expect 37. i've been suggested to use <xsl:value-of select="format-number(concat('0',11) - concat('0',1), '# ##0,00','forme1')" />

or

<xsl:value-of select="format-number(number(concat('0',11)) - number(concat('0',1)), '# ##0,00','forme1')" />
but it is a bit complicated... isn't there something more simple...


To Marrow : i faced troubles while using sum with the tag <B/> i revieve "NaN"

other suggestions ??

Thank.

Michael Leditschke a écrit:

Typically there's some special value you want
in the case where A and/or B don't exist or
are not numeric.

One trick I've used in this case is

<xsl:decimal-format NaN="0"/>

and

<xsl:variable name="fred" select="format-number(A-B)"/>

This way you get "0" if the result is NaN.

HTH
Michael



-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of pcoustillas
Sent: Friday, 23 August 2002 1:44 AM
To: mulberrytech
Subject: [xsl] A - B


hi, how could i do A-B when A or B does not exist or is absent... because without a test i recieve "NaN". Thanks.



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list







XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list







XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • [xsl] A - B
    • pcoustillas - Thu, 22 Aug 2002 17:43:51 +0200
      • Mike Brown - Thu, 22 Aug 2002 11:40:03 -0600 (MDT)
      • Michael Leditschke - Fri, 23 Aug 2002 10:08:53 +1000
        • pcoustillas - Mon, 26 Aug 2002 09:14:17 +0200 <=
      • <Possible follow-ups>
      • Marrow - Thu, 22 Aug 2002 19:07:10 +0100
      • Marrow - Mon, 26 Aug 2002 10:59:24 +0100