Re: [xsl] Transitive closure for XPath

Subject: Re: [xsl] Transitive closure for XPath
From: "Christian Nentwich" <c.nentwich@xxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 23:05:41 +0100
> 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 for a rule for
XMI or for

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

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

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


 XSL-List info and archive:

Current Thread