srini,
I assume the document level element not being well formed was a typo <emp> ⦠</enm>.
If the elements you are processing to catch duplicates are always siblings, as in your example, you can simply do something like:
<xsl:template match="name">
<xsl:if test=". = preceding-sibling::name">
...do something...
</xsl:if>
</xsl:template>
Now, the "do something" can vary depending on how you want to "capture" these errors. You can throw a message to standard output with <xsl:message>. For my stylesheets, I call an error template with an error code that looks up the appropriate text to output via the <xsl:message> element.
â¦sam
|