cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@odoko.co.uk>
Subject Re: XSLT transformation
Date Thu, 04 Aug 2005 10:15:45 GMT
Try upgrading to the latest Cocoon 2.1.X from Subversion. There are some 
improvements there that get around a tendency of Xalan to swallow 
exceptions. You've got a NullPointerException happening, but there's no 
mention of it in your stacktrace, so you're looking in the wrong place 
for it.

Download a subversion client (tortoisesvn.tigris.org if you're on 
windows is good), then point it at 
http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X. You may 
well get better answers out of it.

I still lean towards the problem being in your transformer. Can you post 
some of the code for that here?

Regards, Upayavira

Antony Grinyer wrote:
> The stack trace returned is:
> 
> ERROR   (2005-08-04) 09:46.59:112   [sitemap.handled-errors] (/kde/listcontainers) PoolThread-4/ErrorHandlerHelper:
Error executing pipeline.
> org.apache.cocoon.ProcessingException: Error executing pipeline.: java.lang.RuntimeException
>         at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleException(AbstractProcessingPipeline.java:940)
>         at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:281)
>         at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:483)
>         at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
> 
> << snip >>
> 
> Caused by: java.lang.RuntimeException
>         at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3418)
>         at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:389)
>         at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
>         at org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:560)
>         at org.apache.cocoon.transformation.LogTransformer.endDocument(LogTransformer.java:156)
>         at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
>         at org.apache.cocoon.transformation.AbstractSAXTransformer.endDocument(AbstractSAXTransformer.java:296)
>         at org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
>         at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
>         at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
>         at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
>         at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>         at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:296)
>         at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
> 
> 
> The XML generated by <map:transform type="bdbxml"/> is very simple:
> 
> <?xml version="1.0" encoding="ISO-8859-1" ?> 
>    <bdbxml-transaction transactiontype="retrieve" containername="System.bdbxml" docname="syscontainer.xml">
>      <result status="passed">
>         <containers>
>           <container>
>             <name>Sample</name> 
>            <filename>Sample.bdbxml</filename> 
>            <docnamepath>/publication/metadata/title</docnamepath> 
>            <paramsearchconfig>
>               <context xpath="/publication/chapter">Chapter</context> 
>               <context xpath="/publication/chapter/section">Section</context>

>               <context xpath="/publication/chapter/section/para">Paragraph</context>

>         </paramsearchconfig>
>       </container>
>    </containers>
>  </result>
> </bdbxml-transaction>
> 
> And all I want to do is output the content of the container elements child elements name
and filename. This is the XSLT:
> 
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
>  <xsl:template match="/">
>   <html>
>    <body>
>     <xsl:apply-templates/>
>    </body>
>   </html>
>  </xsl:template>
> 
>  <xsl:template match="result">
>   <xsl:apply-templates/>
>  </xsl:template>
> 
>  <xsl:template match="containers">
>   <xsl:apply-templates/>
>  </xsl:template>
> 
>  <xsl:template match="container">
>   Name:<xsl:value-of select="/name"/> Filename:<xsl:value-of select="/filename"/>
>  </xsl:template>
> 
>  <xsl:template match="@*|node()" priority="-2">
>   <xsl:copy>
>    <xsl:apply-templates select="@*|node()"/>
>   </xsl:copy>
>  </xsl:template>
> 
>  <xsl:template match="text()" priority="-1">
>   <xsl:value-of select="."/>
>  </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> 
> I've used the Cocoon log tranformer to catch what is coming out of the bdbxml transformer
> anf I believe it looks okay:
> 
> [setup] ---------------------------- [Thu Aug 04 09:59:35 BST 2005] ----------------------------
> [setDocumentLocator] systemid=file:/C:/cocoon-2.1.7/build/webapp/kde/content/showsyscontainer.xml,publicid=null
> [startDocument] 
> [startElement] uri=,local=bdbxml-transaction,raw=bdbxml-transaction
> [            ] 1. uri=,local=transactiontype,qname=transactiontype,type=CDATA,value=retrieve
> [            ] 2. uri=,local=containername,qname=containername,type=CDATA,value=System.bdbxml
> [            ] 3. uri=,local=docname,qname=docname,type=CDATA,value=syscontainer.xml
> [startElement] uri=,local=result,raw=result
> [            ] 1. uri=null,local=status,qname=status,type=CDATA,value=passed
> [setDocumentLocator] systemid=null,publicid=null
> [startDocument] 
> [startElement] uri=,local=containers,raw=containers
> [startElement] uri=,local=container,raw=container
> [startElement] uri=,local=name,raw=name
> [characters] Sample
> [endElement] uri=,local=name,raw=name
> [startElement] uri=,local=filename,raw=filename
> [characters] Sample.bdbxm
> [characters] l
> [endElement] uri=,local=filename,raw=filename
> [startElement] uri=,local=docnamepath,raw=docnamepath
> [characters] /publication/metadata/title
> [endElement] uri=,local=docnamepath,raw=docnamepath
> [startElement] uri=,local=paramsearchconfig,raw=paramsearchconfig
> [startElement] uri=,local=context,raw=context
> [            ] 1. uri=,local=xpath,qname=xpath,type=CDATA,value=/publication/chapter
> [characters] Chapter
> [endElement] uri=,local=context,raw=context
> [startElement] uri=,local=context,raw=context
> [            ] 1. uri=,local=xpath,qname=xpath,type=CDATA,value=/publication/chapter/section
> [characters] Section
> [endElement] uri=,local=context,raw=context
> [startElement] uri=,local=context,raw=context
> [            ] 1. uri=,local=xpath,qname=xpath,type=CDATA,value=/publication/chapter/section/para
> [characters] Paragraph
> [endElement] uri=,local=context,raw=context
> [endElement] uri=,local=paramsearchconfig,raw=paramsearchconfig
> [endElement] uri=,local=container,raw=container
> [endElement] uri=,local=containers,raw=containers
> [endDocument] 
> [endElement] uri=,local=result,raw=result
> [endElement] uri=,local=bdbxml-transaction,raw=bdbxml-transaction
> [endDocument] 
> 
> 
> Could this exception be Xalan related? I'm using jdk 1.4.2, however I have copied across
> the xalan and xerces jars into the jre/lib/endorsed directory as recommended by the 
> Cocoon installations. Should I try JDK 1.5? 
> 
> Strange thing is I've been able to do basic tranformation on other XML using the
> file generator passed onto XSLT stylesheets (as opposed my java transformer bdbxml).
> 
> Any ideas? It's driving me mad!
> 
> Thanks,
> Ant
> 
> 
> 
>>-----Original Message-----
>>From: Upayavira [mailto:uv@odoko.co.uk]
>>Sent: 04 August 2005 08:57 am
>>To: users@cocoon.apache.org
>>Subject: Re: XSLT transformation
>>
>>Antony Grinyer wrote:
>>
>>>Hi,
>>>
>>>A have a simple sitemap entry as below:
>>>
>>><map:match pattern="listcontainers">
>>>  <map:generate type="file" src="content/showsyscontainer.xml"/>
>>>  <map:transform type="bdbxml"/>
>>>  <map:transform type="xslt" src="style/xsl/containerslist.xsl"/>
>>>  <map:serialize type="html"/>
>>></map:match>
>>>
>>>The generator is a simple XML file which is passed to a java class
>>>transformer ( referenced as type="bdbxml") which returns
>>
>>XML results.
>>
>>>This all works fine if I use <map:serialize type="xml"/>  to simply
>>>output the XML, however if I try to transform the XML
>>
>>output with the
>>
>>>XSLT transformer above I get an error:
>>>
>>>
>>>
>>>>>Error executing pipeline.
>>>
>>>
>>>>>org.apache.cocoon.ProcessingException: Error executing pipeline.:
>>>>>java.lang.RuntimeException
>>>
>>>
>>>I know the XSLT containerslist.xsl is correct as I've tried
>>
>>it against
>>
>>>some sample output XML in XMLSpy, but it appears that when
>>
>>I add this
>>
>>>XSLT transformer I get a Processing Exception?
>>>
>>>In the sitemap.log it is reported as:
>>>
>>>Unable to get parser: java.lang.RuntimeException:
>>>java.lang.NullPointerException
>>
>>Do you get any stack trace with this NPE?
>>
>>Your transformer is passing something down the pipeline as
>>null. This isn't tripping up the XML serializer, but is
>>tripping up the xslt transformer. Go through each of the
>>startElement, etc, calls within your transformer looking at
>>the output. See if you can see any nulls in there.
>>
>>Regards, Upayavira
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>
> 
> 
> 
> -----Original Message-----
> From: Upayavira [mailto:uv@odoko.co.uk]
> Sent: Thu 8/4/2005 8:57 AM
> To: users@cocoon.apache.org
> Subject: Re: XSLT transformation
>  
> Antony Grinyer wrote:
> 
>>Hi,
>>
>>A have a simple sitemap entry as below:
>>
>><map:match pattern="listcontainers">
>>  <map:generate type="file" src="content/showsyscontainer.xml"/>
>>  <map:transform type="bdbxml"/>
>>  <map:transform type="xslt" src="style/xsl/containerslist.xsl"/>
>>  <map:serialize type="html"/>
>></map:match>
>>
>>The generator is a simple XML file which is passed to a java class
>>transformer ( referenced as type="bdbxml") which returns XML results.
>>This all works fine if I use <map:serialize type="xml"/>  to simply
>>output the XML, however if I try to transform the XML output with the
>>XSLT transformer above I get an error:
>>
>>
>>
>>>>Error executing pipeline.
>>
>>
>>>>org.apache.cocoon.ProcessingException: Error executing pipeline.: 
>>>>java.lang.RuntimeException
>>
>>
>>I know the XSLT containerslist.xsl is correct as I've tried it against
>>some sample output XML in XMLSpy, but it appears that when I add this
>>XSLT transformer I get a Processing Exception? 
>>
>>In the sitemap.log it is reported as:
>>
>>Unable to get parser: java.lang.RuntimeException:
>>java.lang.NullPointerException
> 
> 
> Do you get any stack trace with this NPE?
> 
> Your transformer is passing something down the pipeline as null. This 
> isn't tripping up the XML serializer, but is tripping up the xslt 
> transformer. Go through each of the startElement, etc, calls within your 
> transformer looking at the output. See if you can see any nulls in there.
> 
> Regards, Upayavira
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message