Thread [XML & XSLT] Lerne gerade, finde Fehler nicht
(8 answers)
Opened by Thyrius at 2013-02-05 22:46
Folgendes funktioniert wunderbar in Opera 12.14, Firefox 18.01, Internet Explorer 10:
wuerfel.xsl Code (xml): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <style type="text/css"> .value { font-size: 150% } .good { color: green } .bad { color: red } </style> </head> <body> <xsl:apply-templates /> </body> </html> </xsl:template> <xsl:template match="wuerfelzahl"> <xsl:variable name="aktuellerwert" select="."/> <p> <xsl:choose> <xsl:when test="$aktuellerwert > 20"> <span class="bad value"><xsl:value-of select="." /></span> (Zahl zu gross) </xsl:when> <xsl:otherwise> <span class="good value"><xsl:value-of select="." /></span> </xsl:otherwise> </xsl:choose> </p> </xsl:template> </xsl:stylesheet> wuerfel.xml Code (xml): (dl
)
1 2 3 4 5 6 7 8 9 10 <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="wuerfel.xsl" ?> <test> <wuerfelzahl> 12 </wuerfelzahl> <wuerfelzahl> 9 </wuerfelzahl> <wuerfelzahl> 14 </wuerfelzahl> <wuerfelzahl> 20 </wuerfelzahl> <wuerfelzahl> 5 </wuerfelzahl> <wuerfelzahl> 39 </wuerfelzahl> </test> Last edited: 2013-02-06 09:26:49 +0100 (CET) |