Hy,
I just was trying to run the example
wrotten by Steve Punk in "Getting started with Cocoon 2" http://www.xml.com/lpt/a/2002/07/10/cocoon2.html
More precisely, the last example that
calculates a factorial from a numeric value submitted via HTTP
POST.
Here's the sitemap:
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components> <map:generators> <map:generator name="request" logger="sitemap.generator.request" label="data" src="org.apache.cocoon.generation.RequestGenerator"/> </map:generators> <map:transformers
default="xslt">
<map:transformer name="xslt" logger="sitemap.transformer.xslt" src="org.apache.cocoon.transformation.TraxTransformer"/> </map:transformers> <map:serializers>
<map:serializer name="xml" mime-type="text/xml" src="org.apache.cocoon.serialization.XMLSerializer"/> </map:serializers> <map:matchers
default="wildcard">
<map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/> </map:matchers> </map:components>
<map:pipelines>
<map:pipeline> <map:match pattern="mypage"> <map:generate type="request"/> <map:transform src="transforms/mystylesheet.xsl"/> <map:serialize type="xml"/> </map:match> </map:pipeline> </map:pipelines>
</map:sitemap> and here's the file mystylesheet.xsl
that I've copied in integrality from the original source:
<?xml version="1.0"?> <!-- Author: Steven P. Punte "[EMAIL PROTECTED]" --> <!-- Description: Computes Factorial --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:http="http://xml.apache.org/cocoon/requestgenerator/2.0"> <xsl:template match="/"> <page> <incoming-value> <xsl:value-of select="/http:request/http:requestParameters/ http:parameter/http:value"/> </incoming-value> <computed-factorial> <xsl:call-template name="factorial"> <xsl:with-param name="input" select="/http:request/ http:requestParameters/http:parameter/http:value"/> </xsl:call-template> </computed-factorial> </page> </xsl:template> <xsl:template name="factorial"> <xsl:param name="input"/> <xsl:choose> <xsl:when test="$input > 1"> <xsl:variable name="tmp"> <xsl:call-template name="factorial"> <xsl:with-param name="input" select="$input - 1" /> </xsl:call-template> </xsl:variable> <xsl:value-of select="$tmp * $input"/> </xsl:when> <xsl:otherwise> 1 </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
When I run this by pointing my browser to http://localhost/mypage?input=5 I receive the following error message: description org.apache.cocoon.ProcessingException: Exception in creating Transform Handler: org.xml.sax.SAXParseException: The XML declaration may only appear at the very beginning of the document. I don't understand why this occurs. Can you help me please? Thanks in advance, |
- Re: pb with http request cyril vidal
- Re: pb with http request Joerg Heinicke
- Re: pb with http request Cyril Vidal
- Re: pb with http request cyril vidal