Birgit: Attribute auslesen

Beitrag lesen

Hallo Björn,

vielen Dank für Deine Hilfe, das war schon die Lösung!

Birgit

ich habe mal wieder ein kleines Problem mit XSL. Dazu folgender Ausschnitt aus der XML-Datei:

...
<catgry>
   <catValu>1</catValu>
   <txt>Ja</txt>
   <catStat type="freq">1999</catStat>
   <catStat type="percent">97.75</catStat>
</catgry>
...

Wie kann ich jetzt die Werte von type="freq" und type="percent" ausgeben?

<xsl:value-of select='@type'> wobei das jeweilige catStat-Element der aktuelle Kontextknoten sein muss, möglich wäre

xsl:template match = catgry
  xsl:apply-templates select = catStat

xsl:template match = catStat
  xsl:value-of select = @type

Mit <xsl:value-of select="catStat/@type='freq'" /> und <xsl:value-of select="catStat/@type='percent'" /> bekomme ich nur die Ausgabe "true" oder "false". Kann mir da jemand weiterhelfen?

Wenn schon konditional, dann mit eckigen Klammern:

catStat[@type = 'perc']