[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Correction: Re: Question on expected XQuery return per standards

David Sewell dsewell at virginia.edu
Fri Mar 27 14:34:38 PST 2009


 Correction: Re:  Question on expected XQuery return
	per standards
"We're seeing different behavior from a couple of XML parsers." I mean
"XQuery parsers", sorry.

On Fri, 27 Mar 2009, David Sewell wrote:

> Over on another list there has been a discussion of unexpected results
> from an XQuery like the following. The issues are how the parser
> interprets, in particular, the abbreviated syntax '//' and '[N]' as an
> equivalent to '[position() eq N]'.
>
> My belief is that the standard requires that two nodes (p2, p4) should
> be returned for result sets 1-4 below, because the interpretation of the
> XPath should in each case be identical. Set 5, on the other hand, should
> return only p2.
>
> We're seeing different behavior from a couple of XML parsers. Anyone
> care to read from the stone tablets on this one?
>
> (: begin query :)
>
> let $xml :=
>   <root>
>     <div>
>       <p>p1</p>
>       <p>p2</p>
>     </div>
>     <div>
>       <p>p3</p>
>       <p>p4</p>
>     </div>
>   </root>
>
> return (
>   <set1>{ $xml/descendant-or-self::node()/p[position() eq 2] }</set1>,
>   <set2>{ $xml//p[position() eq 2] }</set2>,
>   <set3>{ $xml/descendant-or-self::node()/p[2] }</set3>,
>   <set4>{ $xml//p[2] }</set4>,
>   <set5>{ $xml/descendant::p[2] }</set5>
> )
>
> (: end query :)
>
> David S.
>
>

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 801079, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: http://x-query.com/mailman/listinfo/talk   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.