Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: xpath: predicate to choose only elements that match a one of a list of values [Thread Next] Re: xpath: predicate to choose only elements that match a one of a list of valuesTo: NULL Date: 7/7/2008 3:59:00 PM On Jul 3, 4:38=A0pm, "Joseph J. Kesselman" <keshlam-nos...@comcast.net> wrote: > However, > =A0 =A0 =A0 =A0 "//apple | //orange" > really should work. XPath defines the '|' character as the union > operator. This expression should return every node that is either an > apple or an orange. You say you're only getting the first hit -- but I > think that means either you're misusing your XPath API by failing to > retrieve results after the first, or it's broken and you should consider > switching implementations. (You didn't show us the surrounding code, and > I don't recognize the syntax, so I can't say much beyond that.) The problem here is that the xpath_eval statement defaults a third parameter which indicates that you only want the FIRST node returned. =46rom the Virtuoso Documentation.... xpath_eval (in xpath_expression varchar, in xml_tree XML Entity, [in index integer], [in named_params vector]); Description This function returns the result of applying the XPath expression to the context node. By default only the first result is returned, but supplying a third argument allows you to specify an index for the value; the default assumes a value of 1 here. A value of 0 returns an array of 0 or more elements, one for each value selected by the XPath expression. Always pays to check the documentation!! Nick | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
