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

Re: Transitive closure for XPath

Subject: Re: Transitive closure for XPath
From: "Christian Nentwich" <c.nentwich@xxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 23:05:41 +0100
xpath forall
> So if you want to stick to the way that XPath currently works, then
> perhaps you should define closure() as:
>   node-set closure(node-set, string)
> which would make the above examples:
>   closure(/closure/node[1], 'id(@child)')
>   closure(/closure/node[1], 'key("myKey", @child)')

I thought about that, but if I did that, then at least xalan would not parse
the second parameter for me. I would have to create a new xpath query on the
fly. (which is probably not so bad anyway, now that I think about it). On
the other hand, it would fit in with the spec rather more nicely (albeit as
a bit of a cheat, leaving the semantics undefined for the application)


> Just a couple of other things - on the page explaining closure(), you
> say that you *need* to get this list of 'descendants' within an XPath,
> but don't say why. It would be good to see the XSLT context in which
> you're using it.

Ok, I am specifying consistency rules that express constraints between
distributed documents. Have a look at
http://www.xlinkit.com/dangerzone/UML/associationclass.xml for a rule for
XMI or http://www.cs.ucl.ac.uk/staff/c.nentwich/publications.html for
papers.

Pasting a short rule:
<forall var="a" in="/Advert">
      <exists var="p" in="/Catalogue/Product">
          <equal op1="$a/ProductName/text()" op2="$p/Name/text()"/>
      </exists>
  </forall>

The rule says that each advert has to correspond to a product definition
(which may be in another file). We use xpath to pick out the things we
relate. As for transitive closure, for some of the rules for the UML I need
to say things like "forall parents of X" in a path expression.


> Dynamic' module, and this would be a good function to have within it,
> or perhaps in a different module if you think there's a better fit.
> If you don't know about EXSLT, have a look at http://www.exslt.org/.

I haven't had a look at it for a while, but I will tomorrow. But, as I said,
I mainly use xpath standalone..

Christian




 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.