Hallo,
ich weiß mir gerade nicht anderst zu helfen...
Auf meiner Seite gibt es eine Textarea zum Editieren(TinyMCE) und eine "Ausgabefläche"(Beispielsweise ein Div). Jetzt weiß ich nicht, wie ich das apply-templates so aufrufen soll, dass im Falle der Textarea eine Maskierung stattfindet und im Falle des Divs nicht. An <template match="text()"> kann ich ja keinen Paramter mitgeben, oder? Und wenn, wie wirkt sich das auf die anderen Templates (z.B. <xsl:template match="em">) aus, die mir die inneren XML-Knoten von <valuetiny> abarbeiten?
Grüße
Siri
<textarea name="tinyname" class="tinyclass">
<xsl:apply-templates select="./valuetiny/text() | ./valuetiny/*"/>
</textarea>
<div>
<xsl:apply-templates select="./valuetiny/text() | ./valuetiny/*"/>
</div>
<xsl:template match="em">
<em><xsl:apply-templates select="text() | *"/></em>
</xsl:template>
<xsl:template match="strong">
<strong><xsl:apply-templates select="text() | *"/></strong>
</xsl:template>
<xsl:template match="b">
<b><xsl:apply-templates select="text() | *"/></b>
</xsl:template>
...
<xsl:template match="text()">
<xsl:variable name="replace1">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="."/>
<xsl:with-param name="replace" select=" '<' "/>
<xsl:with-param name="by" select=" '&lt;' "/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="replace2">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$replace1"/>
<xsl:with-param name="replace" select=" '>' "/>
<xsl:with-param name="by" select=" '&gt;' "/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$replace2" />
</xsl:template>
<xsl:template name="string-replace-all">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$by"/>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>