You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2004/08/23 10:46:36 UTC
cvs commit: cocoon-lenya/src/webapp/lenya/xslt/info sitetree2tree.xsl
andreas 2004/08/23 01:46:36
Modified: src/webapp/lenya/xslt/info sitetree2tree.xsl
Log:
escaping characters ", <, > in sitetree labels
Revision Changes Path
1.37 +39 -4 cocoon-lenya/src/webapp/lenya/xslt/info/sitetree2tree.xsl
Index: sitetree2tree.xsl
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/xslt/info/sitetree2tree.xsl,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- sitetree2tree.xsl 13 Mar 2004 12:42:06 -0000 1.36
+++ sitetree2tree.xsl 23 Aug 2004 08:46:36 -0000 1.37
@@ -25,6 +25,8 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="http://apache.org/cocoon/lenya/navigation/1.0">
+<xsl:import href="../util/string-functions.xsl"/>
+
<xsl:output omit-xml-declaration="yes" encoding = "iso-8859-1" />
<xsl:param name="contextprefix"/>
@@ -137,17 +139,50 @@
<xsl:template name="getLabel">
<xsl:choose>
<xsl:when test="s:label[lang($chosenlanguage)]">
- <xsl:value-of select="s:label[lang($chosenlanguage)]"/>
+ <xsl:call-template name="escape-characters">
+ <xsl:with-param name="input" select="s:label[lang($chosenlanguage)]"/>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="s:label[lang($defaultlanguage)]">
- <xsl:value-of select="s:label[lang($defaultlanguage)]"/>
+ <xsl:call-template name="escape-characters">
+ <xsl:with-param name="input" select="s:label[lang($defaultlanguage)]"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="s:label"/>
+ <xsl:call-template name="escape-characters">
+ <xsl:with-param name="input" select="s:label"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="s:label"/>
+
+
+<xsl:template name="escape-characters">
+ <xsl:param name="input"/>
+ <xsl:variable name="escape-lt">
+ <xsl:call-template name="search-and-replace">
+ <xsl:with-param name="input" select="$input"/>
+ <xsl:with-param name="search-string"><</xsl:with-param>
+ <xsl:with-param name="replace-string">&lt;</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="escape-gt">
+ <xsl:call-template name="search-and-replace">
+ <xsl:with-param name="input" select="$escape-lt"/>
+ <xsl:with-param name="search-string">></xsl:with-param>
+ <xsl:with-param name="replace-string">&gt;</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="escape-quot">
+ <xsl:call-template name="search-and-replace">
+ <xsl:with-param name="input" select="$escape-gt"/>
+ <xsl:with-param name="search-string">"</xsl:with-param>
+ <xsl:with-param name="replace-string">\"</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$escape-quot"/>
+</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org