|
Subject: [xsl] How do I avoid NaN (Simple Maths) From: Arthur Maloney <ArthurM@xxxxxxxxxx> Date: Thu, 13 Mar 2008 10:35:41 +0000 |
Hello Xsl-list,
How do I do simple addition but avoid Nan when elements are not in
Xml.
i.e /count is 0(zero) and hence element <Table1> is not included
say
<Table1><callResultCode>25</callResultCode>...</Table1> whole
element not included
I'm using Xml v1.0 and Xsl v1.0
Simple maths total=x1+x2+x3...+xN
n is 0 to 20
callResultCode in range 1-280
In e.g. below I want $clientContacted= 6 + 1
I'm getting NaN (I assume this is because other elements are not
present)
Xml Structure
(A bit ugly but for ease "default from a database". It is changeable)
<NewDataSet>
<Table>
...
</Table>
<Table1>
<callResultCode>280</callResultCode>
<callResultDescription>Client agree</callResultDescription>
<count>6</count>
</Table1>
<Table1>
<callResultCode>29</callResultCode>
<callResultDescription>Elderly / Infirm (incapable of decision
making)</callResultDescription>
<count>1</count>
</Table1>
...
</NewDataSet>
Variable(s) poupulated at head of Xsl file (works OK when all
elements present)
<xsl:variable name="clientContacted"
select="NewDataSet/Table1[callResultCode=280]/count
+ NewDataSet/Table1[callResultCode=25]/count
+ NewDataSet/Table1[callResultCode=281]/count
+ NewDataSet/Table1[callResultCode=28]/count
+ NewDataSet/Table1[callResultCode=29]/count
+ NewDataSet/Table1[callResultCode=36]/count"/>
<xsl:variable name="extinctRecords" select="$clientContacted
+ NewDataSet/Table1[callResultCode=30]/count
+ NewDataSet/Table1[callResultCode=6]/count"/>
Best regards,
Arthur mailto:ArthurM@xxxxxxxxxx
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] No of Times Named Templat, Senthilkumaravelan K | Thread | RE: [xsl] How do I avoid NaN (Simp, Michael Kay |
| RE: [xsl] inserting tabs, Michael Kay | Date | RE: [xsl] How do I avoid NaN (Simp, Michael Kay |
| Month |