cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anathan...@apache.org
Subject svn commit: r440023 - in /cocoon/trunk: blocks/cocoon-xsp/cocoon-xsp-sample/src/main/resources/COB-INF/logicsheets/interpolation.xsl core/cocoon-core/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
Date Mon, 04 Sep 2006 10:44:45 GMT
Author: anathaniel
Date: Mon Sep  4 03:44:44 2006
New Revision: 440023

URL: http://svn.apache.org/viewvc?view=rev&rev=440023
Log:
XSP block: Using document('') in logicsheet caused NPE.

Modified:
    cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-sample/src/main/resources/COB-INF/logicsheets/interpolation.xsl
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java

Modified: cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-sample/src/main/resources/COB-INF/logicsheets/interpolation.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-sample/src/main/resources/COB-INF/logicsheets/interpolation.xsl?view=diff&rev=440023&r1=440022&r2=440023
==============================================================================
--- cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-sample/src/main/resources/COB-INF/logicsheets/interpolation.xsl
(original)
+++ cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-sample/src/main/resources/COB-INF/logicsheets/interpolation.xsl
Mon Sep  4 03:44:44 2006
@@ -30,8 +30,14 @@
   <xsl:template match="xsp-interpolation:greeting">
     <!-- Using attribute and text interpolation. -->
     <center style="color:{#color}">Hello logicsheet {#world}!</center>
+    <!-- Testcase for document('') in logicsheet. -->
+    <center style="color:{#color}">
+      <xsl:copy-of select="document('')/*/xsp-interpolation:hello"/> {#world}!
+    </center>
   </xsl:template>
- 
+
+  <xsp-interpolation:hello>Hello document </xsp-interpolation:hello>
+  
   <xsl:template match="@*|*|text()|processing-instruction()">
     <xsl:copy>
       <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java?view=diff&rev=440023&r1=440022&r2=440023
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
Mon Sep  4 03:44:44 2006
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -243,6 +244,14 @@
 
                 if (null == template) {
                     throw new XSLTProcessorException("Unable to create templates for stylesheet:
" + stylesheet.getURI());
+                }
+
+                // Must set base for Xalan stylesheet.
+                // Otherwise document('') in logicsheet causes NPE.
+                Class clazz = template.getClass();
+                if (clazz.getName().equals("org.apache.xalan.templates.StylesheetRoot"))
{
+                    Method method = clazz.getMethod("setHref", new Class[]{String.class});
+                    method.invoke(template, new Object[]{id});
                 }
 
                 putTemplates(template, stylesheet, id);



Mime
View raw message