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

Re: validating against the standard W3C


validating xpath

Paul T wrote:
> > hang on a minute.. :) There are counter-examples. See the link below for
> > a formal specification XPath.
> > http://cm.bell-labs.com/cm/cs/who/wadler/papers/xpath-semantics/
> xpath-semantics.pdf
> >
> > This is the clearest spec of XPath I've seen, and much easier to read
> > than the verbose XPath spec. Then again, maybe XPath lends itself to
> > this kind of specification. (denotational semantics)
>
> In the XPath paper that is as a clearest XPath
> spec, where is the keyword ancestor-of-self ?
>
> Are you sure that that  paper is an XPath specification?


Wadler's semantics were based on an earlier draft of XPath and
(AFAIK) haven't been updated for the final REC.

The missing axes are pretty easy to specify though, and the
rest of the paper is still accurate.

    A[[ ancestor-or-self ]] x           = parent*(x)
    A[[ descendants-or-self ]] x        = children*(x)

We need a few more primitive functions on nodes to define
the others.  Each of the following returns a singleton set
or the empty set:

    nextSibling :: Node -> Set(Node)
    prevSibling :: Node -> Set(Node)
    firstChild  :: Node -> Set(Node)

With these we can define:

    A[[ following-sibling ]] x          = nextSibling+(x)
    A[[ preceding-sibling ]] x          = prevSibling+(x)

    A[[ following ]] x  =  (children* `o` nextSibling+ `o` parent*)(x)
    A[[ preceding ]] x  =  (children* `o` prevSibling+ `o` parent*)(x)

where (f `o` g)(x) == { z : y <- g(x), z <- f(y) }

The P[[ ... ]] and  D[[ ... ]] rules for the new axes are obvious.


--Joe English

  jenglish@f...

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.