[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How do I avoid NaN (Simple Maths)
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|