XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XQuery Puzzle

Ok, I was asking the question about whether there is any difference in
XPath 1 and 2 when evaluating expressions with multiple predicates *in
general* rather than siting the earlier example. But to make it clear,
if I change the earlier example to that suggested by Andrew (note the
added <foo>) :-

let $set := (<foo>
  <div1>one</div1>,
  <div1 class="doc">two</div1>,
  <div1>three</div1>,
  <div1 class="doc">four</div1>,
  <gotcha>START</gotcha>,
  <div1>five</div1></foo>
)
return $set//gotcha/preceding-sibling::div1[@class="doc"][1]

would the result be any different ?

Michael stated above that XQuery always uses XPath 2.0 so maybe this
is a red herring, however, I was asking because the OP that raised
this question on the Exist forum, made this statement ..

'... The xpath 2.0 spec is unclear regarding multiple predicates, but
it would seem that, at least for eXist and Saxon, the first predicate
causes the expression to
evaluate to a sequence before the last predicate is considered.'

Fraser.

On 17/04/2008, David Carlisle <davidc@nag.co.uk> wrote:
>
> > Is there any difference in the way that XPath 1.0 and 2.0 evaluate
> > multiple predicates like this (there was a different result between
> > some of the XQuery processors used and it wasn't clear whether these
> > implemented XPath 1.0 or 2.0) ?
>
> the reason the expression did not generate the result that you exected
> was that the input consisted of a sequence of parentless elements.
>
> parentless elements do not exist in the Xpath1  data model so this
> situation can not arise in that case.
>
>
> David
>
>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS