cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Coboos" <cromo...@gmx.net>
Subject HSSFSerializer doesn't work with XSLTransformer?
Date Thu, 19 Aug 2004 18:45:46 GMT
Hello,

I have a big problem using the HSSFSerializer. If I'm creating a xml
worksheet by hand and then serializing it using the HSSFSerializer everthing
works well. But If I'm using a XSLTransformer before to create the
structure, I got a NullPointerException:

Original Exception: java.lang.RuntimeException:
java.lang.NullPointerException
	at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3407)
	at
org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerH
andlerImpl.java:433)
	at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
	at
org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer
.java:549)
	at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
	at
org.apache.cocoon.transformation.AbstractSAXTransformer.endDocument(Abstract
SAXTransformer.java:279)
	at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
	at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
	at
org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator
.java:3230)
	at
org.apache.cocoon.generation.JXTemplateGenerator.performGeneration(JXTemplat
eGenerator.java:2979)
	at
org.apache.cocoon.generation.JXTemplateGenerator$TransformerAdapter$Template
Consumer.endDocument(JXTemplateGenerator.java:2742)
	at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
	at
org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
	at
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStrea
mInterpreter.java:83)

The according pipeline look as follows:

      <map:match pattern="search/*.xls">
         <map:generate type="file" src="sql-sheets/dynamic.xml"/>
         <map:transform type="xslt" src="stylesheets/searchResult2XLS.xsl"/>
         <map:serialize type="xls"/>
      </map:match>

If I'am using the xml serializer and saving the xml to a file and then
serializing this file using the HSSFSerializer everthing works well.

      <map:match pattern="search/*.xls">
         <map:generate type="file" src="sql-sheets/dynamic.xml"/>
         <map:transform type="xslt" src="stylesheets/searchResult2XLS.xsl"/>
         <map:serialize type="xml"/>
      </map:match>

Then:

      <map:match pattern="test.xls">
         <map:generate type="file" src="test.xml"/>
         <map:serialize type="xls"/>
      </map:match>

Why is it not possible to use the HSSFSerializer together with the
XSLTransformer?

Here is my simple stylesheet:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:sql="http://apache.org/cocoon/SQL/2.0"
                              xmlns:gmr="http://www.gnome.org/gnumeric/v7">

   <xsl:template match="sql:rowset">
   <gmr:Workbook>
      <gmr:SheetNameIndex>
         <gmr:SheetName>Sheet1</gmr:SheetName>
      </gmr:SheetNameIndex>
      <gmr:Sheets>
         <gmr:Sheet>
         <gmr:Name>Sheet1</gmr:Name>
         <gmr:MaxCol>-1</gmr:MaxCol>
         <gmr:MaxRow>-1</gmr:MaxRow>
         <gmr:Cells>
         <xsl:for-each select="./sql:row">
            <xsl:variable name="rowNum" select="position()-1"/>
               <xsl:for-each select="node()">
               <xsl:variable name="colNum" select="position()-1"/>
               <gmr:Cell Row="{$rowNum}" Col="{$colNum}"
ValueType="60"><xsl:value-of select="."/></gmr:Cell>
               </xsl:for-each>
            </xsl:for-each>
         </gmr:Cells>
         </gmr:Sheet>
      </gmr:Sheets>
   </gmr:Workbook>
   </xsl:template>

</xsl:stylesheet>

Thank you very much.

Regards
Stephan


Mime
View raw message