Re: [xslt] Problem in the improving of a rss feed
- From: Vincent Lefevre <vincent+gnome vinc17 org>
- To: xslt gnome org
- Subject: Re: [xslt] Problem in the improving of a rss feed
- Date: Tue, 25 Oct 2005 11:02:10 +0200
On 2005-10-25 10:01:45 +0200, Roberto Alvares wrote:
> <xsl:value-of select="description" disable-output-escaping="yes"/>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I think you want the opposite: a second layer of escaping. You have
to do that manually (unless libxslt has an extension to do that?)
with templates like:
<xsl:template name="encode">
<xsl:param name="string" select="."/>
<xsl:variable name="enc1">
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="char" select="'&'"/>
<xsl:with-param name="repl" select="'&amp;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="enc2">
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="$enc1"/>
<xsl:with-param name="char" select="'<'"/>
<xsl:with-param name="repl" select="'&lt;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="enc3">
<xsl:call-template name="string-replace">
<xsl:with-param name="string" select="$enc2"/>
<xsl:with-param name="char" select="'>'"/>
<xsl:with-param name="repl" select="'&gt;'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="string($enc3)"/>
</xsl:template>
<xsl:template name="string-replace">
<xsl:param name="string"/>
<xsl:param name="char"/>
<xsl:param name="repl"/>
<xsl:choose>
<xsl:when test="contains($string,$char)">
<xsl:value-of select="concat(substring-before($string,$char),$repl)"/>
<xsl:call-template name="string-replace">
<xsl:with-param name="string"
select="substring-after($string,$char)"/>
<xsl:with-param name="char" select="$char"/>
<xsl:with-param name="repl" select="$repl"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$string"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
--
Vincent Lefèvre <vincent vinc17 org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]