You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Martin Holmes <mh...@uvic.ca> on 2005/05/02 20:19:20 UTC

Generating plain text on Cocoon 2.1.6

I'm having problems generating plain text output (utf-8) on Cocoon 
2.1.6. I get a NullPointerException. The scenario is:

       <map:match pattern="proof/*.txt">
         <map:generate src="abstracts_for_proofing/{1}.xml"/>
         <map:transform type="xinclude"/>
         <map:transform type="xslt" src="xsl/text_out.xsl"/>
         <map:serialize type="text" />
       </map:match>

The XML files are UTF-8 and the XSL file starts out like this:


<xsl:output method="text" encoding="utf-8" media-type="text/plain"/>

<xsl:template match="/">
  	<xsl:processing-instruction
name="cocoon-format">type="text/plain"</xsl:processing-instruction>
  	<plain-text>
		<xsl:apply-templates />
	</plain-text>
</xsl:template>

The XSL works fine running locally in oXygen with Saxon 6.5.3. I've 
tried removing the processing instruction, but it makes no difference. 
I've also tried adding a UTF-8 text serializer to the sitemap like this:

<map:serializer logger="sitemap.serializer.text" mime-type="text/plain"
         name="text" src="org.apache.cocoon.serialization.TextSerializer">
         <encoding>UTF-8</encoding>
       </map:serializer>

but no joy.

I've included the top few lines of the stack trace below. Can anyone 
suggest what the problem might be?

org.apache.cocoon.ProcessingException: Error executing pipeline.: 
java.lang.RuntimeException: java.lang.NullPointerException
	at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleException(AbstractProcessingPipeline.java:825)
	at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:270)
	at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:468)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180)
	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)


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


Re: Generating plain text on Cocoon 2.1.6

Posted by Martin Holmes <mh...@uvic.ca>.
Upayavira wrote:
> you need to show more of the exception stack trace. the bit you showed 
> wasn't the bit that actually held the error.

Sorry -- here's the full thing:

org.apache.cocoon.ProcessingException: Error executing pipeline.: 
java.lang.RuntimeException: java.lang.NullPointerException

cause: java.lang.RuntimeException: java.lang.NullPointerException

full exception chain stacktrace[hide]

org.apache.cocoon.ProcessingException: Error executing pipeline.: 
java.lang.RuntimeException: java.lang.NullPointerException
	at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleException(AbstractProcessingPipeline.java:825)
	at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:270)
	at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:468)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180)
	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180)
	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:606)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
	at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
	at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
	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:562)
	at 
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at 
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at 
org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
	at 
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStreamInterpreter.java:83)
	at 
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(XMLByteStreamInterpreter.java:73)
	at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:256)
	... 38 more
java.lang.RuntimeException: java.lang.NullPointerException
	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:562)
	at 
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at 
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at 
org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
	at 
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStreamInterpreter.java:83)
	at 
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(XMLByteStreamInterpreter.java:73)
	at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:256)
	at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:468)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180)
	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180)
	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:606)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
	at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
	at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Unknown Source)

stacktrace[hide]

java.lang.RuntimeException: java.lang.NullPointerException
	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:562)
	at 
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at 
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
	at 
org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
	at 
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStreamInterpreter.java:83)
	at 
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(XMLByteStreamInterpreter.java:73)
	at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:256)
	at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:468)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180)
	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180)
	at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:606)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
	at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
	at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Unknown Source)


Cheers,
Martin


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


Re: Generating plain text on Cocoon 2.1.6

Posted by Upayavira <uv...@upaya.co.uk>.
you need to show more of the exception stack trace. the bit you showed 
wasn't the bit that actually held the error.

regards, upayavira - who's shift key has stopped working ;-0

Martin Holmes wrote:
> I'm having problems generating plain text output (utf-8) on Cocoon 
> 2.1.6. I get a NullPointerException. The scenario is:
> 
>       <map:match pattern="proof/*.txt">
>         <map:generate src="abstracts_for_proofing/{1}.xml"/>
>         <map:transform type="xinclude"/>
>         <map:transform type="xslt" src="xsl/text_out.xsl"/>
>         <map:serialize type="text" />
>       </map:match>
> 
> The XML files are UTF-8 and the XSL file starts out like this:
> 
> 
> <xsl:output method="text" encoding="utf-8" media-type="text/plain"/>
> 
> <xsl:template match="/">
>      <xsl:processing-instruction
> name="cocoon-format">type="text/plain"</xsl:processing-instruction>
>      <plain-text>
>         <xsl:apply-templates />
>     </plain-text>
> </xsl:template>
> 
> The XSL works fine running locally in oXygen with Saxon 6.5.3. I've 
> tried removing the processing instruction, but it makes no difference. 
> I've also tried adding a UTF-8 text serializer to the sitemap like this:
> 
> <map:serializer logger="sitemap.serializer.text" mime-type="text/plain"
>         name="text" src="org.apache.cocoon.serialization.TextSerializer">
>         <encoding>UTF-8</encoding>
>       </map:serializer>
> 
> but no joy.
> 
> I've included the top few lines of the stack trace below. Can anyone 
> suggest what the problem might be?
> 
> org.apache.cocoon.ProcessingException: Error executing pipeline.: 
> java.lang.RuntimeException: java.lang.NullPointerException
>     at 
> org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleException(AbstractProcessingPipeline.java:825) 
> 
>     at 
> org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:270) 
> 
>     at 
> org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:468) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:180) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68) 
> 
>     at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:89) 
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Generating plain text on Cocoon 2.1.6

Posted by Martin Holmes <mh...@uvic.ca>.
Nailed it!

I had this in my stylesheet:

<xsl:output method="text" encoding="utf-8" media-type="text/plain"/>

Changing it to

<xsl:output type="text" encoding="utf-8" media-type="text/plain"/>

("type" instead of "method") solves the problem!

But that shouldn't be, should it? According to XSLT 1.0 and 2.0, the 
attribute should be "method". Am I missing something here?

Cheers,
Martin

Upayavira wrote:
> Martin Holmes wrote:
> 
>> I'm having problems generating plain text output (utf-8) on Cocoon 
>> 2.1.6. I get a NullPointerException. The scenario is:
>>
>>       <map:match pattern="proof/*.txt">
>>         <map:generate src="abstracts_for_proofing/{1}.xml"/>
>>         <map:transform type="xinclude"/>
>>         <map:transform type="xslt" src="xsl/text_out.xsl"/>
>>         <map:serialize type="text" />
>>       </map:match>
>>
>> The XML files are UTF-8 and the XSL file starts out like this:
>>
>>
>> <xsl:output method="text" encoding="utf-8" media-type="text/plain"/>
>>
>> <xsl:template match="/">
>>      <xsl:processing-instruction
>> name="cocoon-format">type="text/plain"</xsl:processing-instruction>
>>      <plain-text>
>>         <xsl:apply-templates />
>>     </plain-text>
>> </xsl:template>
>>
>> The XSL works fine running locally in oXygen with Saxon 6.5.3. I've 
>> tried removing the processing instruction, but it makes no difference. 
>> I've also tried adding a UTF-8 text serializer to the sitemap like this:
>>
>> <map:serializer logger="sitemap.serializer.text" mime-type="text/plain"
>>         name="text" src="org.apache.cocoon.serialization.TextSerializer">
>>         <encoding>UTF-8</encoding>
>>       </map:serializer>
>>
>> but no joy.
>>
>> I've included the top few lines of the stack trace below. Can anyone 
>> suggest what the problem might be?
> 
> 
> Thanks for the other stack trace. Unfortunately, those ones are usually 
> very difficult to debug, as the error shows up in Xalan as a null 
> pointer exception, which was actually triggered by something much 
> further back in the pipeline.
> 
> Now, have you tried replacing <map:serialize type="text"/> with 
> <map:serialize type="xml"/>
> 
> What do you see? Does it produce your text content, but wrapped in XML?
> 
> Also, the processing instruction, to my knowledge, won't make any 
> difference. It looks like a Cocoon 1.x instruction, that Cocoon 2 
> doesn't know about. Configuration like that happens in the sitemap, not 
> in processing instructions.
> 
> Regards, Upayavira


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


Re: Generating plain text on Cocoon 2.1.6

Posted by Martin Holmes <mh...@uvic.ca>.
I now have a working system, and in case anyone else has the same 
problem, this is what I had to do:

1. Use an absolutely minimal xsl:output element in the stylesheet:

	<xsl:output encoding="UTF-8" />

2. Create my own serializer based on the standard text serializer, but 
with a new name and an explicit encoding parameter:

	<map:serializer logger="sitemap.serializer.text" 				 
mime-type="text/plain"
         	name="utf8text" 					
		src="org.apache.cocoon.serialization.TextSerializer">

		<encoding>UTF-8</encoding>

       	</map:serializer>

3. Use that serializer in my map:match:

	 <map:serialize type="utf8text"/>

No other combination (and I tried virtually everything!) would work 
properly; some caused the null pointer exception in Xalan, some resulted 
in empty XML documents, and some tripped up when encountering a 
character with a codepoint above 255.

This was Cocoon 2.1.6 running on Tomcat 5.5, with Java 1.5.

Hope this helps someone!

Martin

Martin Holmes wrote:
> Hi there,
> 
> When I switch to the XML serializer, I get an empty XML document:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> with no root element, and the wrong encoding.
> 
> This is strange; something must be throwing the Xalan parser for a loop, 
> but there's nothing weird at all in the XSL as far as I can see; it's 
> adapted from another file which works fine on a different installation 
> of Cocoon (2.1.5). I've copied the XSLT below -- can anyone see anything 
> wrong here?
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   version="1.0">
> 
> <!-- output method should be text -->
>        
> <xsl:output method="text" encoding="utf-8" media-type="text/plain"/>
> 
> <xsl:strip-space elements="*"/>
> <xsl:preserve-space elements="l hi" />
> 
> <xsl:template match="/">
>         <xsl:apply-templates />
> </xsl:template>
> 
> <!-- Suppress the header -->
> <xsl:template match="teiHeader">
>     <!-- do nothing! -->
> </xsl:template>
> 
> <xsl:template match="figure">
>   <xsl:text>&#x000d;&#x000a;</xsl:text>
>   [<xsl:value-of select="figDesc" />]
>   <xsl:text>&#x000d;&#x000a;</xsl:text>
> </xsl:template>
> 
>   <xsl:template match="div | div0 | div1 | div2 | ab | head | p | lg | l 
> | titlePart | docAuthor/name | docAuthor/address/addrLine">
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
>     <xsl:apply-templates />
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
> </xsl:template>
> 
> <xsl:template match="lb">
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
> </xsl:template>
> 
> <xsl:template match="list">
>   <xsl:for-each select="item">
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
>     <xsl:choose>
>       <xsl:when test="../@type='unordered'">
>         <xsl:text>&#x2022;</xsl:text>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:value-of select="position()" />.
>       </xsl:otherwise>
>     </xsl:choose>
>     <xsl:apply-templates />
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
>   </xsl:for-each>
> </xsl:template>
> 
>  <xsl:template match="note">
>    <xsl:choose>
>      <xsl:when test="@n">
>        [Note <xsl:value-of select="@n"/>: <xsl:apply-templates />]
>      </xsl:when>
>      <xsl:otherwise>
>        <xsl:apply-templates />
>      </xsl:otherwise>
>    </xsl:choose>
>  </xsl:template>
> 
>   <xsl:template match="cit"><xsl:if test="q">"<xsl:apply-templates 
> select="q" />"</xsl:if><xsl:if test="bibl"> (<xsl:apply-templates 
> select="bibl" />)</xsl:if>
>   </xsl:template>
> 
>   <xsl:template match="biblStruct">
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
>       <xsl:apply-templates />
>   </xsl:template>
> 
>   <xsl:template match="biblStruct//title | biblStruct//publisher | 
> biblStruct//pubPlace | biblStruct//date | biblStruct//biblScope">
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
>     <xsl:apply-templates />
>   </xsl:template>
> 
>   <xsl:template match="biblStruct//name">
>     <xsl:text>&#x000d;&#x000a;</xsl:text>
>     <xsl:value-of select="@reg" />
>   </xsl:template>
> 
> <xsl:template match="text()">
>     <xsl:value-of select="." />
> </xsl:template>
> 
> Cheers,
> Martin
> 
> </xsl:stylesheet>
> 
> Upayavira wrote:
> 
>> Martin Holmes wrote:
>>
>>> I'm having problems generating plain text output (utf-8) on Cocoon 
>>> 2.1.6. I get a NullPointerException. The scenario is:
>>>
>>>       <map:match pattern="proof/*.txt">
>>>         <map:generate src="abstracts_for_proofing/{1}.xml"/>
>>>         <map:transform type="xinclude"/>
>>>         <map:transform type="xslt" src="xsl/text_out.xsl"/>
>>>         <map:serialize type="text" />
>>>       </map:match>
>>>
>>> The XML files are UTF-8 and the XSL file starts out like this:
>>>
>>>
>>> <xsl:output method="text" encoding="utf-8" media-type="text/plain"/>
>>>
>>> <xsl:template match="/">
>>>      <xsl:processing-instruction
>>> name="cocoon-format">type="text/plain"</xsl:processing-instruction>
>>>      <plain-text>
>>>         <xsl:apply-templates />
>>>     </plain-text>
>>> </xsl:template>
>>>
>>> The XSL works fine running locally in oXygen with Saxon 6.5.3. I've 
>>> tried removing the processing instruction, but it makes no 
>>> difference. I've also tried adding a UTF-8 text serializer to the 
>>> sitemap like this:
>>>
>>> <map:serializer logger="sitemap.serializer.text" mime-type="text/plain"
>>>         name="text" 
>>> src="org.apache.cocoon.serialization.TextSerializer">
>>>         <encoding>UTF-8</encoding>
>>>       </map:serializer>
>>>
>>> but no joy.
>>>
>>> I've included the top few lines of the stack trace below. Can anyone 
>>> suggest what the problem might be?
>>
>>
>>
>> Thanks for the other stack trace. Unfortunately, those ones are 
>> usually very difficult to debug, as the error shows up in Xalan as a 
>> null pointer exception, which was actually triggered by something much 
>> further back in the pipeline.
>>
>> Now, have you tried replacing <map:serialize type="text"/> with 
>> <map:serialize type="xml"/>
>>
>> What do you see? Does it produce your text content, but wrapped in XML?
>>
>> Also, the processing instruction, to my knowledge, won't make any 
>> difference. It looks like a Cocoon 1.x instruction, that Cocoon 2 
>> doesn't know about. Configuration like that happens in the sitemap, 
>> not in processing instructions.
>>
>> Regards, Upayavira


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


Re: Generating plain text on Cocoon 2.1.6

Posted by Martin Holmes <mh...@uvic.ca>.
Hi there,

When I switch to the XML serializer, I get an empty XML document:

<?xml version="1.0" encoding="ISO-8859-1"?>

with no root element, and the wrong encoding.

This is strange; something must be throwing the Xalan parser for a loop, 
but there's nothing weird at all in the XSL as far as I can see; it's 
adapted from another file which works fine on a different installation 
of Cocoon (2.1.5). I've copied the XSLT below -- can anyone see anything 
wrong here?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0">

<!-- output method should be text -->
		
<xsl:output method="text" encoding="utf-8" media-type="text/plain"/>

<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="l hi" />

<xsl:template match="/">
		<xsl:apply-templates />
</xsl:template>

<!-- Suppress the header -->
<xsl:template match="teiHeader">
	<!-- do nothing! -->
</xsl:template>

<xsl:template match="figure">
   <xsl:text>&#x000d;&#x000a;</xsl:text>
   [<xsl:value-of select="figDesc" />]
   <xsl:text>&#x000d;&#x000a;</xsl:text>
</xsl:template>

   <xsl:template match="div | div0 | div1 | div2 | ab | head | p | lg | 
l | titlePart | docAuthor/name | docAuthor/address/addrLine">
	<xsl:text>&#x000d;&#x000a;</xsl:text>
	<xsl:apply-templates />
     <xsl:text>&#x000d;&#x000a;</xsl:text>
</xsl:template>

<xsl:template match="lb">
	<xsl:text>&#x000d;&#x000a;</xsl:text>
</xsl:template>

<xsl:template match="list">
   <xsl:for-each select="item">
     <xsl:text>&#x000d;&#x000a;</xsl:text>
     <xsl:choose>
       <xsl:when test="../@type='unordered'">
         <xsl:text>&#x2022;</xsl:text>
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="position()" />.
       </xsl:otherwise>
     </xsl:choose>
     <xsl:apply-templates />
     <xsl:text>&#x000d;&#x000a;</xsl:text>
   </xsl:for-each>
</xsl:template>

  <xsl:template match="note">
    <xsl:choose>
      <xsl:when test="@n">
        [Note <xsl:value-of select="@n"/>: <xsl:apply-templates />]
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

   <xsl:template match="cit"><xsl:if test="q">"<xsl:apply-templates 
select="q" />"</xsl:if><xsl:if test="bibl"> (<xsl:apply-templates 
select="bibl" />)</xsl:if>
   </xsl:template>

   <xsl:template match="biblStruct">
     <xsl:text>&#x000d;&#x000a;</xsl:text>
       <xsl:apply-templates />
   </xsl:template>

   <xsl:template match="biblStruct//title | biblStruct//publisher | 
biblStruct//pubPlace | biblStruct//date | biblStruct//biblScope">
     <xsl:text>&#x000d;&#x000a;</xsl:text>
     <xsl:apply-templates />
   </xsl:template>

   <xsl:template match="biblStruct//name">
     <xsl:text>&#x000d;&#x000a;</xsl:text>
     <xsl:value-of select="@reg" />
   </xsl:template>

<xsl:template match="text()">
	<xsl:value-of select="." />
</xsl:template>

Cheers,
Martin

</xsl:stylesheet>

Upayavira wrote:
> Martin Holmes wrote:
> 
>> I'm having problems generating plain text output (utf-8) on Cocoon 
>> 2.1.6. I get a NullPointerException. The scenario is:
>>
>>       <map:match pattern="proof/*.txt">
>>         <map:generate src="abstracts_for_proofing/{1}.xml"/>
>>         <map:transform type="xinclude"/>
>>         <map:transform type="xslt" src="xsl/text_out.xsl"/>
>>         <map:serialize type="text" />
>>       </map:match>
>>
>> The XML files are UTF-8 and the XSL file starts out like this:
>>
>>
>> <xsl:output method="text" encoding="utf-8" media-type="text/plain"/>
>>
>> <xsl:template match="/">
>>      <xsl:processing-instruction
>> name="cocoon-format">type="text/plain"</xsl:processing-instruction>
>>      <plain-text>
>>         <xsl:apply-templates />
>>     </plain-text>
>> </xsl:template>
>>
>> The XSL works fine running locally in oXygen with Saxon 6.5.3. I've 
>> tried removing the processing instruction, but it makes no difference. 
>> I've also tried adding a UTF-8 text serializer to the sitemap like this:
>>
>> <map:serializer logger="sitemap.serializer.text" mime-type="text/plain"
>>         name="text" src="org.apache.cocoon.serialization.TextSerializer">
>>         <encoding>UTF-8</encoding>
>>       </map:serializer>
>>
>> but no joy.
>>
>> I've included the top few lines of the stack trace below. Can anyone 
>> suggest what the problem might be?
> 
> 
> Thanks for the other stack trace. Unfortunately, those ones are usually 
> very difficult to debug, as the error shows up in Xalan as a null 
> pointer exception, which was actually triggered by something much 
> further back in the pipeline.
> 
> Now, have you tried replacing <map:serialize type="text"/> with 
> <map:serialize type="xml"/>
> 
> What do you see? Does it produce your text content, but wrapped in XML?
> 
> Also, the processing instruction, to my knowledge, won't make any 
> difference. It looks like a Cocoon 1.x instruction, that Cocoon 2 
> doesn't know about. Configuration like that happens in the sitemap, not 
> in processing instructions.
> 
> Regards, Upayavira


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


Re: Generating plain text on Cocoon 2.1.6

Posted by Upayavira <uv...@upaya.co.uk>.
Martin Holmes wrote:
> I'm having problems generating plain text output (utf-8) on Cocoon 
> 2.1.6. I get a NullPointerException. The scenario is:
> 
>       <map:match pattern="proof/*.txt">
>         <map:generate src="abstracts_for_proofing/{1}.xml"/>
>         <map:transform type="xinclude"/>
>         <map:transform type="xslt" src="xsl/text_out.xsl"/>
>         <map:serialize type="text" />
>       </map:match>
> 
> The XML files are UTF-8 and the XSL file starts out like this:
> 
> 
> <xsl:output method="text" encoding="utf-8" media-type="text/plain"/>
> 
> <xsl:template match="/">
>      <xsl:processing-instruction
> name="cocoon-format">type="text/plain"</xsl:processing-instruction>
>      <plain-text>
>         <xsl:apply-templates />
>     </plain-text>
> </xsl:template>
> 
> The XSL works fine running locally in oXygen with Saxon 6.5.3. I've 
> tried removing the processing instruction, but it makes no difference. 
> I've also tried adding a UTF-8 text serializer to the sitemap like this:
> 
> <map:serializer logger="sitemap.serializer.text" mime-type="text/plain"
>         name="text" src="org.apache.cocoon.serialization.TextSerializer">
>         <encoding>UTF-8</encoding>
>       </map:serializer>
> 
> but no joy.
> 
> I've included the top few lines of the stack trace below. Can anyone 
> suggest what the problem might be?

Thanks for the other stack trace. Unfortunately, those ones are usually 
very difficult to debug, as the error shows up in Xalan as a null 
pointer exception, which was actually triggered by something much 
further back in the pipeline.

Now, have you tried replacing <map:serialize type="text"/> with 
<map:serialize type="xml"/>

What do you see? Does it produce your text content, but wrapped in XML?

Also, the processing instruction, to my knowledge, won't make any 
difference. It looks like a Cocoon 1.x instruction, that Cocoon 2 
doesn't know about. Configuration like that happens in the sitemap, not 
in processing instructions.

Regards, Upayavira

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