xsl-list
[Top] [All Lists]

RE: [xsl] How do I avoid NaN (Simple Maths)

2008-03-13 03:45:43
  In e.g. below I want      $clientContacted=  6 + 1
  I'm getting NaN (I assume this is because other elements are not
  present)

     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"/>


Try

<xsl:variable name="clientContacted"
select="sum(NewDataSet/Table1[callResultCode=(280,25,281,28,29,36)]/count)"/


In XSLT 1.0 change the predicate to [callResultCode=280 or callResultCode=25
or....]

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>