Subject: Re: Dependency Sorting, first of kind
From: James Clark <jjc@xxxxxxxxxx>
Date: Fri, 05 Nov 1999 13:34:02 +0700
|
Francis Norton wrote:
> The general answer is that that you can do all the basic set operations
> in XSLT. Use them and strip out your buggy iterative code. I can't
> answer for the performance effects, however!
>
> I'll write up the following in a note tonight - I have tested them, and
> they all work sweetly:
>
> set union (any node in a or in b):
> <xsl:variable name="x" select="$a | $b" />
>
> set intersection (any node in a and in b):
> <xsl:variable name="x" select="$a[. = $b]" />
>
> set difference (any node in a but not in b):
> <xsl:variable name="x" select="$a[not(. = $b)]" />
$a | $b returns the set of nodes that are members of $a or $b. If this
is what you mean by set union, then the set intersection of $a and $b
should be the set of nodes that are members of both $a and $b. But $a[.
= $b] does not return this; it returns the nodes in $a for which there
is a node in $b with the same value.
James
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|