joerg 2004/05/08 07:00:39
Modified:
src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/java
logicsheet-util.xsl
Log:
using XSLTExtension:excape() instead of translate() for creating correct
javacode for tabs, linefeeds and carriage returns
Revision Changes Path
1.4 +19 -20
cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/java/logicsheet-util.xsl
Index: logicsheet-util.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/java/logicsheet-util.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- logicsheet-util.xsl 5 Apr 2004 12:25:31 -0000 1.3
+++ logicsheet-util.xsl 8 May 2004 14:00:39 -0000 1.4
@@ -33,7 +33,8 @@
<xsl:stylesheet version="1.0"
xmlns:xsp="http://apache.org/xsp"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.XSLTExtension">
<!--
Namespace prefix for this logicsheet.
@@ -42,6 +43,9 @@
<xsl:call-template name="get-namespace-prefix"/>
</xsl:param>
+<xsl:variable name="extension" select="XSLTExtension:new()"
+
xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.XSLTExtension"/>
+
<!--
Find the namespace prefix used in the source document for a given
namespace URI.
@@ -132,7 +136,7 @@
</xsl:when>
<xsl:otherwise>
<xsl:choose>
- <xsl:when test="string-length($default) = 0">
+ <xsl:when test="not($default)">
<xsl:choose>
<xsl:when test="$required = 'true'">
<xsl:call-template name="error">
@@ -158,22 +162,17 @@
""
<xsl:for-each select="$content/node()">
<xsl:choose>
- <xsl:when test="name(.)">
- <!-- element -->
- <xsl:choose>
- <xsl:when test="namespace-uri(.)='http://apache.org/xsp'
and local-name(.)='text'">
- <!-- xsp:text element -->
- + "<xsl:value-of select="."/>"
- </xsl:when>
- <xsl:otherwise>
- <!-- other elements -->
- + <xsl:apply-templates select="."/>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:when test="self::xsp:text">
+ <!-- xsp:text element -->
+ + "<xsl:value-of select="XSLTExtension:escape($extension,
.)"/>"
+ </xsl:when>
+ <xsl:when test="self::*">
+ <!-- other elements -->
+ + <xsl:apply-templates select="."/>
</xsl:when>
<xsl:otherwise>
<!-- text node -->
- + "<xsl:value-of select="translate(.,'	 ','
')"/>"
+ + "<xsl:value-of select="XSLTExtension:escape($extension,
.)"/>"
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
@@ -212,7 +211,7 @@
</xsl:when>
<xsl:otherwise>
<xsl:choose>
- <xsl:when test="string-length($default) = 0">
+ <xsl:when test="not($default)">
<xsl:choose>
<xsl:when test="$required = 'true'">
<xsl:call-template name="error">
@@ -234,7 +233,7 @@
<xsl:template name="get-nested-content">
<xsl:param name="content"/>
<xsl:choose>
- <xsl:when test="$content/xsp:text">"<xsl:value-of
select="$content"/>"</xsl:when>
+ <xsl:when test="$content/xsp:text">"<xsl:value-of
select="XSLTExtension:escape($extension, $content)"/>"</xsl:when>
<xsl:when test="$content/*">
<xsl:apply-templates select="$content/*"/>
</xsl:when>
@@ -272,7 +271,7 @@
</xsl:when>
<xsl:otherwise>
<xsl:choose>
- <xsl:when test="string-length($default) = 0">
+ <xsl:when test="not($default)">
<xsl:choose>
<xsl:when test="$required = 'true'">
<xsl:call-template name="error">