RE: [xsl] constructing the Node Sets

Subject: RE: [xsl] constructing the Node Sets
From: "Roger Glover" <glover_roger@xxxxxxxxx>
Date: Tue, 28 Jan 2003 00:39:11 -0600
Idea copied from Michael Kay's "XSLT Programmer's Reference", 2nd ed., Wrox
Press, 2001, p. 425 ...

<xsl:variable name="C" select="$A[ count( . | $B ) = count( $B ) ]"/>

The select expression selects the node subset C of node set A, composed of
any member node of A which, when added to node set B, produces a node set
the same size as B (in other words, the node was already in node set B).

The usage of A and B in the select expression can be reversed with no side
effects except possibly:
    o   a change in the list ordering of nodes in node set C
    o   a change in the speed of execution of the expression

-- Roger Glover

Siva Jasthi wrote
> I have constructed two variables (A and B) each of which contains a Node
> Set (through select="XPath Expression").
>
> A = [Node1, Node2, Node3, Node4, Node5]
> B = [Node3, Node4, Node5, Node6, Node7, Node8]
>
> I now would like to construct another variable C with the Nodes that exist
> both in A and B.  (So as to produce a third table with the Nodes that are
> common to both A and B).
>
> C= [Node3, Node4, Node5]
>
> Is there any way to construct C from A and B?.



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


Current Thread