I have two nodes with unknown structure, for example:
<EXAMPLE1>
<A>text a</A>
<B>
<C>text c</C>
<D>
<E>text e</E>
<A>text second A</A>
</D>
</B>
</EXAMPLE1>
<EXAMPLE2>
<A>text a</A>
<B>
<C_DIFFERENT>text c</C_DIFFERENT>
<D>
<E>DIFFERENT TEXT</E>
<A>text second A</A>
</D>
</B>
</EXAMPLE2>
They may be complete equals (having just different base names), but may be different (having another value or different set of tags).
And task is to check, are they equials or not.
I created this:
<xsl:for-each select="//EXAMPLE1//*[not(*)]">
<xsl:if test="not(//EXAMPLE2//*[not(*) and name() = name(current())]) or //EXAMPLE2//*[not(*) and name() = name(current())]/text() != current()/text()">
<!-- PRINT MY STUFF -->
</xsl:if>
</xsl:for-each>
<xsl:for-each select="//EXAMPLE2//*[not(*)]">
<xsl:if test="not(//EXAMPLE1//*[not(*) and name() = name(current())]) or //EXAMPLE1//*[not(*) and name() = name(current())]/text() != current()/text()">
<!-- PRINT MY STUFF -->
</xsl:if>
</xsl:for-each>
(I'm trying to move over all leaf nodes of EXAMPLE1, search same at EXAMPLE2 and check if same exist and if it has same value, and then do same for EXAMPLE2 and EXAMPLE1)
But it doesn't works, because, for example, there is node named that appears twice, and I can't compare first with first and second with second. And I have to "print my stuff" just if they are equials.
Also it looks like bicycle, and I hope XSLT 1.0 has something more useful and simple, then such constructions.
Please, help me find it.