cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <>
Subject [PATCH] Bugfix for document() function when called from Cocoon
Date Tue, 15 Aug 2000 19:36:41 GMT
I'm crossposting this to the cocoon-users list as some people have reported 
problems using document() in Cocoon (can't remember what they were), and I 
thought this might be related. (I realise this or similar problems may have 
been posted hundreds of times to xalan-dev, but since the web mailing list 
archive is still down, I can't tell.)

Here is a simple patch for a problem I encountered trying to insert another 
xml file from within a Producer in Cocoon. The Producer calls Xalan, and the 
XSLT sheet contains a line as follows:

  <xsl:copy-of select="document(.)"/>

First some details of the problem. It wasn't inserting from an absolute file 
URL, so I modified FuncDocument to print a stack trace, and got a 
StackUnderflowException in org.apache.xalan.xslt.StylesheetHandler. Checking 
for an empty stack fixed the problem. I don't understand what was going on, 
but the fix works4me.

My config is:

Cocoon 1.8 latest CVS
Sun JDK1.2.2_6 for Linux

and I'm using org.apache.cocoon.transformer.XalanTransformer as my interface 
to Xalan. The file I'm inserting is

<?xml version="1.0"?>
<cms:part type="common"


    <link href="search.xml">Home</link>
    <link href="search.xml">Search</link>
    <link href="profilelondon.html">Profile</link>
    <link href="contactus.xml">Contact us</link>
    <link href="regoption.xml">Register</link>
    <link href="products.xml?categoryid=11">Special Offers</link>
    <link href="products.xml?categoryid=8">New Products</link>
    <link href="products.xml?categoryid=6">Last-minute Purchases</link>


Here is the patch

--- src/org/apache/xalan/xslt/    Tue Aug 15 19:14:04 
+++ src/org/apache/xalan/xslt/        Tue Aug 15 
19:13:50 2000
@@ -1077,7 +1077,8 @@
           // now we have to look up the stack...
           if(null == nsh)
-            ElemTemplateElement parent = 
+            ElemTemplateElement parent =
+              (m_elems.empty () ? null : 
             while(null != parent)
               int tok = parent.getXSLToken();

Robin Green
i-tao Ltd.
4 Skyline Village
London E14 9TS
United Kingdom
Phone +44 20 7537 2233  Fax +44 70 8081 5118

Get Your Private, Free E-mail from MSN Hotmail at

View raw message