I'm using Saxon 8.
I must be over thinking this and I've reach a mental block.
My application is to compare two nearly identical XML files (or collections of XML files) and identify specific differences.
I might have a node somewhere in one file with a value of "XYZZY" that may not exist in the other file.
It's certainly easy enough to find if it does exist
Code:
<xsl:template name="CmdCommon">
<xsl:param name="source"></xsl:param>
<xsl:param name="target"></xsl:param>
<xsl:for-each select="$source//TL1CommandNameHeading/Head">
<xsl:if test=". = $target//TL1CommandNameHeading/Head">
<xsl:value-of select="."></xsl:value-of>
<xsl:text>#x0A;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
but finding if it doesn't exist is proving a bit tougher.
My initial choice is returning nothing
Code:
<xsl:template name="CmdDifference">
<xsl:param name="source"></xsl:param>
<xsl:param name="target"></xsl:param>
<xsl:for-each select="$source//TL1CommandNameHeading/Head">
<xsl:if test="empty(. = $target//TL1CommandNameHeading/Head)">
<xsl:value-of select="."></xsl:value-of>
<xsl:text>#x0A;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
How do I determine if a specific value for a node in one document doesn't exist in another?
Thanks!
------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876
Michael Hare