XSLT
Aus ProgrammingWiki
Wiki-Quelltext dieser Seite.
<language>XSLT</language> Eine ausführliche Einführung in XSLT mit Beispiele im Wiki findet sich hier: [[Einf%C3%BChrung_in_die_XML-Technologien_XPath,_XSLT_und_XQuery/XSLT|XSLT]] <code id="4d2ff78d3db26" rows="20" cols="80"> <produktnews> Die neuesten Produktnachrichten: <beschreibung> Die Firma <hersteller>Fridolin Soft</hersteller> hat eine neue Version des beliebten Ballerspiels <produkt>HitYourStick</produkt> herausgebracht. Nach Angaben des Herstellers soll die neue Version, die nun auch auf dem Betriebssystem <produkt>Ganzfix</produkt> läuft, um die <preis>80 Dollar</preis> kosten. </beschreibung> <beschreibung> Von <hersteller>Ripfiles Inc.</hersteller> gibt es ein Patch zu der Sammel-CD-ROM <produkt>Best of other people's ideas</produkt>. Einige der tollen Web-Seiten-Templates der CD-ROM enthielten bekanntlich noch versehentlich nicht gelöschte Angaben der Original-Autoren. Das Patch ist für schlappe <preis>200 Euro</preis> zu haben. </beschreibung> </produktnews> </code> <run id="4d2ff78d3dba6"> <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html><head></head><body style="font-family:Verdana; font-size:24px; color:green"> <xsl:apply-templates /> </body></html> </xsl:template> <xsl:template match="beschreibung"> <p style="font-family:Verdana; font-size:13px; color:black"> <xsl:apply-templates /> </p> </xsl:template> <xsl:template match="hersteller"> <span style="font-weight:bold; color:red"><xsl:value-of select="." /></span> </xsl:template> <xsl:template match="produkt"> <span style="font-weight:bold; color:blue"><xsl:value-of select="." /></span> </xsl:template> <xsl:template match="preis"> <b><xsl:value-of select="." /></b> </xsl:template> </xsl:stylesheet> </run> Eine andere Verwendung dieser XML Datei: <run id="4d2ff78d3dc05"> <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html><head></head><body style="font-family:Verdana; font-size:24px; color:green"> <xsl:apply-templates /> </body></html> </xsl:template> <xsl:template match="beschreibung"> <p style="font-family:Verdana; font-size:13px; color:black"> <xsl:apply-templates /> </p> </xsl:template> <xsl:template match="hersteller"> <span style="font-weight:bold; color:blue"><xsl:value-of select="." /></span> </xsl:template> <xsl:template match="produkt"> <span style="font-weight:bold; color:red"><xsl:value-of select="." /></span> </xsl:template> <xsl:template match="preis"> <b><xsl:value-of select="." /></b> </xsl:template> </xsl:stylesheet> </run>