Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Sum function in an XPath expression using ASP Sum function in an XPath expression using ASPTo: NULL Date: 8/7/2004 4:54:00 PM This is a multi-part message in MIME format. ------=_NextPart_000_0016_01C47C9F.1EA5C080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am trying to do a sum of amounts node using the following XPath = expression sum(//Charges/Charge/Amount). The XPath expression works fine = when I run it on my XML, using an XSL. However I want to use the same = expression through a DOMDocument as follows.=20 <% dim TotalCharge, MyXML ' Suppose that I have my xml loaded in a DOMDocument called MyXML. So I = am trying to do a sum of all Charges. TotalCharge =3D MyXML.selectSingleNode("sum(//Charges/Charge/Amount)") %> The above call fails because it expects a node from the XPath = expression, however the value returned is a Number.=20 Is there some way of making this work? Regards, Atif Sarfraz ------=_NextPart_000_0016_01C47C9F.1EA5C080 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.3790.186" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I am trying to do a sum of amounts node = using the=20 following XPath expression <FONT=20 color=3D#0000ff>sum(//Charges/Charge/Amount)</FONT>. The XPath = expression works=20 fine when I run it on my XML, using an XSL. However I want to use the = same=20 expression through a DOMDocument as follows. </FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial color=3D#0000ff size=3D2><%</FONT></DIV> <DIV><FONT face=3DArial color=3D#0000ff size=3D2>dim TotalCharge, = MyXML</FONT></DIV> <DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV> <DIV><FONT face=3DArial color=3D#0000ff size=3D2>' Suppose that I have = my xml loaded=20 in a DOMDocument called MyXML. So I am trying to do a sum of all=20 Charges.</FONT></DIV> <DIV><FONT face=3DArial color=3D#0000ff size=3D2>TotalCharge =3D=20 MyXML.selectSingleNode("sum(//Charges/Charge/Amount)")</FONT></DIV> <DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV> <DIV><FONT face=3DArial color=3D#0000ff size=3D2>%></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>The above call fails because it expects = a node from=20 the XPath expression, however the value returned is a Number. = </FONT></DIV> <DIV><FONT face=3DArial size=3D2>Is there some way of making this = work?</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Regards,</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Atif Sarfraz</FONT></DIV></BODY></HTML> ------=_NextPart_000_0016_01C47C9F.1EA5C080-- | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
