Subject: Re: [xsl] xsl: Actual output is "" : Expected output is 0 From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Wed, 20 Aug 2008 15:22:55 +0530 |
It seems your requirement can be fulfilled by the code, <xsl:attribute name="nb-discount"><xsl:value-of select="Charge[@Id='99']/@Amount - Charge[@Id='125']/@Amount"/></xsl:attribute> there seems to be no need of xsl:if. On 8/20/08, Sathasivam, Elayaraja <elayaraja.sathasivam@xxxxxxxxxxxxx> wrote: > XSLT: Version 1.0 > > Requriement: Converting xml to xml files. > > XSL file: > > <xsl:attribute name="nb-discount"> > <xsl:variable name="d" select="Charge[@Id='99']/@Amount - > Charge[@Id='125']/@Amount"/> > <xsl:if test="$d"> > <xsl:value-of select="$d"/> <!-- Output is > nb-discount="" why the output is not 0 as expected--> > </xsl:if> > </xsl:attribute> > > XML file: > > 1) <Charge Id="99" Amount="12.60" CurrCode="EUR" Type="9" PT="P"/> > <Charge Id="125" Amount="12.60" CurrCode="EUR" Type="5" PT="P"/> > Actual Output: nb-discount="" > Expected Output: nb-discount="0" > > 2) <Charge Id="99" Amount="12.60" CurrCode="EUR" Type="9" PT="P"/> > <Charge Id="125" Amount="14.60" CurrCode="EUR" Type="5" PT="P"/> > Actual Output: nb-discount="-2" > Expected Output: nb-discount="-2" > > > Regards, > Raja -- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl: Actual output is "" , Mandar Jagtap | Thread | [xsl] (Re-)Escaping entities in inp, David Vergnaud |
Re: [xsl] xsl: Actual output is "" , Andrew Welch | Date | [xsl] (Re-)Escaping entities in inp, David Vergnaud |
Month |