B
Bryan Galvin
Hi all,
I posted a message on this topic before, but now I have a request for
help. Previously "A. Bolmarcich" answered this query for me, but the
problem has changed slightly...
I have two node-sets
a=
<values>
<value>A</value>
<value>B</value>
<value>C</value>
<value>D</value>
</nodes>
and b=
<values>
<value>A</value>
<value>B</value>
</values>
How can I create a third nodeset 'c' which contains all nodes from 'a'
that DO NOT EXIST in 'b'.
If 'b' was a single-node set
b =
<values>
<value>A</value>
</values>
So the following expression ( as provided by A. Bolmarcich ) worked in
this case: <xsl:variable name="c" select="$a[. != $b]"/>
I have been studying the XPATH spec and trying to extend this
expression for use with 'b' as a multi-node set. I suspect that it is
not possible to perform this operation in one expression. A solution I
do have is this:
<xsl:variable name="c">
<xsl:for-each select="$a">
<xsl:if test="count($b[. != current()/value]) = 0">
<xsl:copy-of select="current()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
Any suggestions if this is possible in one expression?
Bryan Galvin
I posted a message on this topic before, but now I have a request for
help. Previously "A. Bolmarcich" answered this query for me, but the
problem has changed slightly...
I have two node-sets
a=
<values>
<value>A</value>
<value>B</value>
<value>C</value>
<value>D</value>
</nodes>
and b=
<values>
<value>A</value>
<value>B</value>
</values>
How can I create a third nodeset 'c' which contains all nodes from 'a'
that DO NOT EXIST in 'b'.
If 'b' was a single-node set
b =
<values>
<value>A</value>
</values>
So the following expression ( as provided by A. Bolmarcich ) worked in
this case: <xsl:variable name="c" select="$a[. != $b]"/>
I have been studying the XPATH spec and trying to extend this
expression for use with 'b' as a multi-node set. I suspect that it is
not possible to perform this operation in one expression. A solution I
do have is this:
<xsl:variable name="c">
<xsl:for-each select="$a">
<xsl:if test="count($b[. != current()/value]) = 0">
<xsl:copy-of select="current()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
Any suggestions if this is possible in one expression?
Bryan Galvin