Is there a way to copy 2 or 3 nodes of XML to a variable using XSLT? I'm looking for nodes and not the node values.
My sample XML is:
<node1>
<node2>
<node3>abc</node3>
<node4>def</node4>
</node2>
</node1>
<node1>
<node2>
<node3>123</node3>
<node4>456</node4>
</node2>
</node1>
And my XSLT sample is:
<xsl:for-each select="/node1/node2">
<xsl:if test="current()/node4 ! = '456'">
<xsl:copy-of select="./node3" />
<xsl:copy-of select="./node4" />
</xsl:if>
</xsl:foreach>
The problem with this is that I'm getting node4
everytime as the first node of the XML instead of current one. On node3
I'm getting the current one and there's no problem.