[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A theory problem

Subject: Re: A theory problem
From: James Clark <jjc@xxxxxxxxxx>
Date: Thu, 28 Oct 1999 17:33:37 +0700
xsl find duplicate subtree
A path expression has the property if 

(a) it doesn't use / and the axis is a forward axis, or

(b) it is a / expression, and the left hand operand has the
"single-level" property and the right hand operand has the
"stays-in-subtree" property.

A path expression E has the "single-level" property if and only if for
any context node C, evaluating E wrt C yields a set of nodes all of
which have the same parent.

A path expression E has the "stays-in-subtree" property if and only if
for any context node C, evaluating E wrt C yields a set of nodes all of
which are in the subtree rooted at C (ie have C in their
ancestor-or-self axis).

It's easy to see this is a sufficient condition for the path expression
to have the property: if x and y have the same parent, and x is before y
in document order, then any node in the subtree rooted at x is before
any node in the subtree rooted at y.

XT implements this.

Kay Michael wrote:
> 
> I sometimes get asked for suggestions for student projects, so if there are
> any budding theoreticians out there, or professors trying to teach theory,
> here's a little problem I want to know the answer to. It's prompted by the
> recent discovery of a bug in SAXON.
> 
> The problem is as follows:
> 
> A path expression returns a nodeset. There is a "natural order" to the
> result which is obtained by following the steps in a particular sequence.
> For some path expressions the natural order will always be the same as
> document order, for others it will not. Provide an algorithm that examines a
> path expression and determines whether it will always return nodes in
> document order.
> 
> Here are some examples of path expressions that have this property:
> 
> child::X
> parent::X
> following::X
> descendant::X
> following-sibling::X
> child::X/child::Y
> child::X/descendant::Y
> following-sibling::X/child::Y
> parent::X/descendant::Y
> child::X/child::Y/child::Z
> 
> and here are some that don't:
> 
> ancestor::X
> preceding::X
> descendant::X/child::Y
> child::X/following-sibling::Y
> descendant::X/parent::Y
> 
> I can't see a pattern emerging, and where the path has more than two
> components I don't think I can rely on intuition any more, it needs some
> formal proof.
> 
> (I do know that I haven't stated the problem fully, in that I haven't
> defined the "natural order" of a step such as descendants::X. A more formal
> statement of the problem must obviously form part of any proof).
> 
> The motivation, of course, is that in SAXON I want to avoid doing a sort
> whenever possible. The prize for the winning entry is that the algorithm
> gets out into the wild!
> 
> Mike Kay
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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-2013 All Rights Reserved.