xsl-list
[Top] [All Lists]

Re: constructing the Node Sets

2003-01-27 18:46:25
XML:

<root>
    <a>
        <node>1</node>
        <node>2</node>
        <node>3</node>
        <node>4</node>
        <node>5</node>
    </a>
    <b>
        <node>3</node>
        <node>4</node>
        <node>5</node>
        <node>6</node>
        <node>7</node>
        <node>8</node>
    </b>
</root>

XSL:

<xsl:template match="/root">
  <root>
    <xsl:variable name="a" select="a/node"/>
    <xsl:variable name="b" select="b/node"/>
    <c>
      <xsl:copy-of select="$a[. = $b]"/>
    </c>
  </root>
</xsl:template>

Result:

<root>
  <c>
    <node>3</node>
    <node>4</node>
    <node>5</node>
  </c>
</root>

Regards,

Joerg

Siva Jasthi wrote:
hi -

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?.
thanks
- siva jasthi


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



<Prev in Thread] Current Thread [Next in Thread>