Here's my humble XML file:
<choice>
<question>
<text>one</text>
<answer>
<text>2</text>
</answer>
<answer>
<text>2</text>
</answer>
</question>
<question>
<text>two</text>
<answer>
<text>d</text>
</answer>
</question>
<question>
<text>three</text>
<answer>
<text>1</text>
</answer>
<answer>
<text>2</text>
</answer>
</question>
</choice>
And this is what I tried to find out if there's duplicate text in "question":
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xsl:template match="/choice">
<xsl:variable name="ok" select="count(question/text)=count(question/text[not(.=following::text)])"/>
<xsl:copy-of select="$ok"/>
<xsl:if test="not($ok)">
<xsl:message terminate="yes">
Error: Duplicate Question
</xsl:message>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Works fine - but how do I find out if there're duplicates in the answer-sections (question one in this example - duplicate "2") ?
Sorry for bothering but I'm really stuck here...