Einzigartige Werte mit Hilfe von XSLT 1.0 (Ohne Verwendung von XSL:Key)

Ich bin vor ein typisches problem während bin immer die Eindeutige Liste mit XSLT 1.0.

Beispiel-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 Variablen enthalten, die XML wie folgt:-

<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>

Ausgabe: Eindeutige Liste von code sollte

abc
def
xyz

Dank

  • Sie behaupten, dass Schlüssel und Muenchian Gruppierung nicht verwendet werden können in Ihrem Fall-ist einfach nicht wahr. Du wirst nun lernen, wie es zu tun. 🙂 +1 für Fragen 🙂
InformationsquelleAutor Siva Charan | 2011-10-03
Schreibe einen Kommentar