Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xpath: predicate to choose only elements that match a one of a list of values

From: nick.hanley@-----.---
To: 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent