![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Evaluate xpath sum() function with msxml >Thread Next - Re: Evaluate xpath sum() function with msxml Re: Evaluate xpath sum() function with msxmlTo: NULL Date: 3/3/2005 6:20:00 AM
"Xerox" <anon@a...> wrote in message
news:uykVfSxHFHA.2648@T......
> Can I not execute the xpath without a stylesheet?
>
> I want something like this: totalPrice = XMLDocument.Evaluate
> ("sum(//item/@price)")
>
No, there's no method to evaluate an XPath expression that evaluates to a
scalar (something that is not a node-set).
Using the transformNode() method is what is used inside the XPath Visualizer
to obtain the result of evaluating any such XPath expression. It first
catches the failure of selectNodes(), then it analyses the error message to
determine that this is not another type of error, then finally, if the error
message is for trying to evaluate an XPath expression returning a scalar, it
invokes transformNode() with a dynamically modified (to have the particular
XPath expression as the value of an "select" attribute) generic stylesheet
that produces the result of evaluating the XPath expression.
Cheers,
Dimitre Novatchev.
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
