Hallo,
folgendes Problem: ich möchte den Inhalt eines XMLS durch XSL in HTML umwandeln und dabei Wörter "highlighten", die im XML gekennzeichnet sind. Hier mein XML-Ausschnitt:
<FELDER>
<FELD>Das ist ein <rot>Text</rot>.</FELD>
<FELD>Der nächste <rot>ebenfalls</rot>.</FELD>
</FELDER>und hier mein XSL-ausschnitt:
<xsl:for-each select="FELDER/FELD">
<pre>
<xsl:value-of select="text()"/>
</pre>
</xsl:for-each>
Probiere es so (ohne xsl:for-each-Konstrukt):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="html"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html401/loose.dtd"
encoding="ISO-8859-1"
version="4.01"
indent="yes"
/>
<xsl:template match="/">
<html>
<head>
<title>Test by TM 01/04</title>
<style type="text/css">
.rot
{
color: #F00;
background-color: #FFF;
}
</style>
</head>
<body>
xsl:apply-templates/
</body>
</html>
</xsl:template>
<xsl:template match="FELDER">
xsl:apply-templates/
</xsl:template>
<xsl:template match="FELD">
<pre>
xsl:apply-templates/
</pre>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="rot">
<span class="rot"><xsl:value-of select="."/></span>
</xsl:template>
</xsl:stylesheet>
MfG, Thomas