ricardo 00/05/06 17:43:39
Modified: src/org/apache/cocoon/processor/xsp xsp-java.xsl
Log:
Added namespace preservation. Added attribute for default session creation. Added 'java.net.*'
to default import list
Revision Changes Path
1.16 +18 -3 xml-cocoon/src/org/apache/cocoon/processor/xsp/xsp-java.xsl
Index: xsp-java.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/xsp-java.xsl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- xsp-java.xsl 2000/04/13 10:42:36 1.15
+++ xsp-java.xsl 2000/05/07 00:43:38 1.16
@@ -70,6 +70,7 @@
package <xsl:value-of select="@package"/>;
import java.io.*;
+ import java.net.*;
import java.util.*;
import org.w3c.dom.*;
import org.xml.sax.*;
@@ -104,10 +105,17 @@
Node xspCurrentNode = document;
Stack xspNodeStack = new Stack();
+ <xsl:variable name="create-session">
+ <xsl:choose>
+ <xsl:when test="@create-session = 'true' or @create-session = 'yes'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
// Make session object readily available
- HttpSession session = request.getSession(false);
+ HttpSession session = request.getSession(<xsl:value-of select="$create-session"/>);
- <xsl:for-each select="/processing-instruction()[not(starts-with(.,'xsp') or
(contains(.,'cocoon-process') and contains(.,'xsp')))]">
+ <xsl:for-each select="//processing-instruction()[not(starts-with(name(.),'xml-logicsheet')
or (starts-with(name(.),'cocoon-process') and contains(.,'xsp')))]">
document.appendChild(
document.createProcessingInstruction(
"<xsl:value-of select="name()"/>",
@@ -225,8 +233,15 @@
</xsl:template>
<xsl:template match="@*">
+ <xsl:variable name="attribute-name">
+ <xsl:choose>
+ <xsl:when test="starts-with(name(.), 'xsp:')">xmlns:<xsl:value-of select="substring(name(.),
5)"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="name(.)"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
((Element) xspCurrentNode).setAttribute(
- "<xsl:value-of select="name(.)"/>",
+ "<xsl:value-of select="$attribute-name"/>",
"<xsl:value-of select="."/>"
);
</xsl:template>
|