"Joerg Heinicke" <joerg(_dot_)heinicke(_at_)gmx(_dot_)de> wrote in message
news:3E35E0F1(_dot_)1030305(_at_)gmx(_dot_)de(_dot_)(_dot_)(_dot_)
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>
The question was for an XPath expression that returns the intersection
of two node-sets. The above obviously will not work like that. E.G. for
nodes that do not have text children, or generally for non-element
nodes, for multiple nodes having the same string string value, for
nodes having more than one text child, etc.
Node-set intersection of a node-set $a and node-set $b is given by the
following XPath expression (Kaysian method):
$a[count(. | $b ) = 1]
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list