I’m facing a typical problem while am getting the Unique list using XSLT 1.0.
Sample XSLT:
<xsl:if test="$tempVar = 'true'">
<xsl:variable name="filePath" select="document($mPath)" />
// Do something
// I can't implement this using "Muenchian Method".
// Since, I can't declare <xsl:key> inside of <xsl:if>
// There is no chance to declare <xsl:key> on top.
// I should get unique list from here only
</xsl:if>
filepath variable would contain XML as follows:-
<Root>
<Data id="102">
<SubData>
<Info code="abc">Information 102</Info>
</SubData>
</Data>
<Data id="78">
<SubData>
<Info code="def">Information 78</Info>
</SubData>
</Data>
<Data id="34">
<SubData>
<Info code="abc">Information 34</Info>
</SubData>
</Data>
<Data id="55">
<SubData>
<Info code="xyz">Information 55</Info>
</SubData>
</Data>
<Data id="86">
<SubData>
<Info code="def">Information 86</Info>
</SubData>
</Data>
<Data id="100">
<SubData>
<Info code="xyz">Information 100</Info>
</SubData>
</Data>
</Root>
Output: Unique list of code should be
abc
def
xyz
Thanks
It isn’t true that one cannot use
<xsl:key>and thekey()function in such circumstances:when this transformation is applied to any XML document (not used in this example), the wanted, correct result is produced: