I would like to compare two XML-files via XSLT. The comparison should be considered to be successful if all elements of a specific type in document 1 are located at the same XPath position in document 2.
Consider
<entry>
<entry1>
<entry2>
<value type="1"/>
</entry2>
</entry1>
</entry>
as document 1.
The element under observation is "value" (with attribute type=1) which is located at entry/entry1/entry2. Therefore a comparison in this sense to
<entry>
<entry0/>
<entry0/>
<entry1>
<entry2>
<value type="1"/>
</entry2>
</entry1>
</entry>
should be considered as successful, while
<entry>
<entry1>
<value type="1"/>
</entry1>
</entry>
is not successful, since "value" (with attribute type=1) is located at entry/entry1. Also the comparison to
<entry>
<entry1>
<entry2>
<value type="2"/>
</entry2>
</entry1>
</entry>
should be considered as not successful since the attribute of value is type=2.
My naive trial to fulfill this task in XSLT was something like:
<xsl:template match="value">
<xsl:if test="not(document($doc2)/.[@type=@type])">
<xsl:text>something is missing</xsl:text>
</xsl:if>
</xsl:template>
This approach wasn't successful because the selection of the desired XPath within the 2nd document seems not to work.
Maybe you have an idea on how to address this question?
Matt