You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Robby Pelssers <ro...@ciber.com> on 2011/06/17 13:18:06 UTC
problem with serialization Cocoon2.2
Hi all,
I have a strange situation I don't really understand.
In my sitemap I have following patterns:
<!--
{1}: basictype-id
{2}: state
{3}: topic-id
-->
<map:match pattern="basictype/*/*/*">
<map:generate src="xquery/getTopic.xquery" type="queryStringXquery">
<map:parameter name="basictypeId" value="{1}"/>
<map:parameter name="state" value="{2}"/>
<map:parameter name="topicId" value="{3}"/>
</map:generate>
<map:transform src="xslt/postprocessXqueryResults.xslt" type="saxon"/>
<map:transform src="xslt/urlTransformer.xslt" type="saxon">
<map:parameter name="contextpath" value="{request:contextPath}"/>
<map:parameter name="drawingExtension" value="{request-param:drawingExtension}"/>
</map:transform>
<map:serialize type="p-topic"/>
</map:match>
<map:match pattern="topic2xhtml/**">
<map:generate src="cocoon:/{1}"/>
<map:transform src="xslt/dita/xslhtml/dita2xhtml.xsl" type="saxon"/>
<map:serialize type="xhtml"/>
</map:match>
<map:match pattern="test">
<map:generate src="data/pinning_information.xml"/>
<map:serialize type="xml"/>
</map:match>
And configured following serializer:
<map:serializer name="p-topic" logger="sitemap.serializer.xml"
mime-type="text/xml;charset=utf-8" src="org.apache.cocoon.serialization.XMLSerializer">
<encoding>UTF-8</encoding>
<doctype-public>-//NXP//DTD P-Topic//EN</doctype-public>
<doctype-system>${p-topic-dtd}</doctype-system>
</map:serializer>
The pattern "basictype/*/*/*" generates a DITA topic by transforming the result of an Xquery.
When I invoke http://localhost:8888/topics/basictype/PH3330L/released/pinning_information?drawingExtension=gif in the browser and save the result [1] to filesystem I see that the doctype has been added correctly:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE p-topic PUBLIC "-//NXP//DTD P-Topic//EN" "http://nww.qa.spider.nxp.com:8311/xmetal/schemas/p-topic.dtd">
<p-topic id="pinning_information">
...
</p-topic>
When I invoke http://localhost:8888/topics/topic2xhtml/basictype/PH3330L/released/pinning_information I would expect the topic to get transformed correctly into XHTML. This does not work however. Just for testing purpose I added [1] in my app into /data/pinning_information.xml and created a new match pattern which reads [1] from disc
But when i now try to invoke http://localhost:8888/topics/topic2xhtml/test the DITA topic does get transformed correctly.
Is there a difference between
a) calling a pipeline that generates a DITA topic on the fly and serializes it using my custom serializer which is used as input for the
topic2xhtml/** pattern
b) reading the DITA topic from filesystem which is used as input for the topic2xhtml/** pattern
It looks like the class attributes which should be added by the DTD are not added in use-case (a) which is why the transform fails.
Any insight is appreciated.
Kind regards,
Robby Pelssers
RE: problem with serialization Cocoon2.2
Posted by Robby Pelssers <ro...@ciber.com>.
Hi Huib,
Actually i'm still facing this issue. I will give it a try.. But it is indeed a strange issue. One option that came to my mind was that the generator actually behaves differently when using the cocoon protocol.
<map:match pattern="topic2xhtml/**">
<map:generate src="cocoon:/{1}"/>
..
</map:match>
But that would take me quite some time to setup my environment to dive into the cocoon sources and step through the code. I will first see if twiddling with those pipelines makes a difference.
Thx for thinking along,
Robby
-----Oorspronkelijk bericht-----
Van: Huib Verweij [mailto:hhv@home.nl]
Verzonden: do 23-6-2011 13:03
Aan: robby.pelssers@nxp.com; users@cocoon.apache.org
CC: Huib Verweij
Onderwerp: Re: problem with serialization Cocoon2.2
Hi Robby,
did you fix it already?
Seems like a strange situation to me.
Maybe Cocoon gets confused by the p-topic serializer, even though it's really a XML serializer in disguise. You could move the "work" to a separate pipeline, serialize that to p-topic in "basictype/*/*/*" and serialize that to HTML in "topic2xhtml/**".
Hartelijke groet,
Huib Verweij.
Op 17 jun 2011, om 13:18 heeft Robby Pelssers het volgende geschreven:
>
> Hi all,
>
> I have a strange situation I don't really understand.
>
> In my sitemap I have following patterns:
>
> <!--
> {1}: basictype-id
> {2}: state
> {3}: topic-id
> -->
> <map:match pattern="basictype/*/*/*">
> <map:generate src="xquery/getTopic.xquery" type="queryStringXquery">
> <map:parameter name="basictypeId" value="{1}"/>
> <map:parameter name="state" value="{2}"/>
> <map:parameter name="topicId" value="{3}"/>
> </map:generate>
> <map:transform src="xslt/postprocessXqueryResults.xslt" type="saxon"/>
> <map:transform src="xslt/urlTransformer.xslt" type="saxon">
> <map:parameter name="contextpath" value="{request:contextPath}"/>
> <map:parameter name="drawingExtension" value="{request-param:drawingExtension}"/>
> </map:transform>
> <map:serialize type="p-topic"/>
> </map:match>
>
> <map:match pattern="topic2xhtml/**">
> <map:generate src="cocoon:/{1}"/>
> <map:transform src="xslt/dita/xslhtml/dita2xhtml.xsl" type="saxon"/>
> <map:serialize type="xhtml"/>
> </map:match>
>
> <map:match pattern="test">
> <map:generate src="data/pinning_information.xml"/>
> <map:serialize type="xml"/>
> </map:match>
>
> And configured following serializer:
>
> <map:serializer name="p-topic" logger="sitemap.serializer.xml"
> mime-type="text/xml;charset=utf-8" src="org.apache.cocoon.serialization.XMLSerializer">
> <encoding>UTF-8</encoding>
> <doctype-public>-//NXP//DTD P-Topic//EN</doctype-public>
> <doctype-system>${p-topic-dtd}</doctype-system>
> </map:serializer>
>
> The pattern "basictype/*/*/*" generates a DITA topic by transforming the result of an Xquery.
>
> When I invoke http://localhost:8888/topics/basictype/PH3330L/released/pinning_information?drawingExtension=gif in the browser and save the result [1] to filesystem I see that the doctype has been added correctly:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE p-topic PUBLIC "-//NXP//DTD P-Topic//EN" "http://nww.qa.spider.nxp.com:8311/xmetal/schemas/p-topic.dtd">
> <p-topic id="pinning_information">
> ...
> </p-topic>
>
> When I invoke http://localhost:8888/topics/topic2xhtml/basictype/PH3330L/released/pinning_information I would expect the topic to get transformed correctly into XHTML. This does not work however. Just for testing purpose I added [1] in my app into /data/pinning_information.xml and created a new match pattern which reads [1] from disc
>
> But when i now try to invoke http://localhost:8888/topics/topic2xhtml/test the DITA topic does get transformed correctly.
>
> Is there a difference between
> a) calling a pipeline that generates a DITA topic on the fly and serializes it using my custom serializer which is used as input for the
> topic2xhtml/** pattern
> b) reading the DITA topic from filesystem which is used as input for the topic2xhtml/** pattern
>
>
> It looks like the class attributes which should be added by the DTD are not added in use-case (a) which is why the transform fails.
>
> Any insight is appreciated.
>
> Kind regards,
> Robby Pelssers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: problem with serialization Cocoon2.2
Posted by Huib Verweij <hh...@home.nl>.
Hi Robby,
did you fix it already?
Seems like a strange situation to me.
Maybe Cocoon gets confused by the p-topic serializer, even though it's really a XML serializer in disguise. You could move the "work" to a separate pipeline, serialize that to p-topic in "basictype/*/*/*" and serialize that to HTML in "topic2xhtml/**".
Hartelijke groet,
Huib Verweij.
Op 17 jun 2011, om 13:18 heeft Robby Pelssers het volgende geschreven:
>
> Hi all,
>
> I have a strange situation I don't really understand.
>
> In my sitemap I have following patterns:
>
> <!--
> {1}: basictype-id
> {2}: state
> {3}: topic-id
> -->
> <map:match pattern="basictype/*/*/*">
> <map:generate src="xquery/getTopic.xquery" type="queryStringXquery">
> <map:parameter name="basictypeId" value="{1}"/>
> <map:parameter name="state" value="{2}"/>
> <map:parameter name="topicId" value="{3}"/>
> </map:generate>
> <map:transform src="xslt/postprocessXqueryResults.xslt" type="saxon"/>
> <map:transform src="xslt/urlTransformer.xslt" type="saxon">
> <map:parameter name="contextpath" value="{request:contextPath}"/>
> <map:parameter name="drawingExtension" value="{request-param:drawingExtension}"/>
> </map:transform>
> <map:serialize type="p-topic"/>
> </map:match>
>
> <map:match pattern="topic2xhtml/**">
> <map:generate src="cocoon:/{1}"/>
> <map:transform src="xslt/dita/xslhtml/dita2xhtml.xsl" type="saxon"/>
> <map:serialize type="xhtml"/>
> </map:match>
>
> <map:match pattern="test">
> <map:generate src="data/pinning_information.xml"/>
> <map:serialize type="xml"/>
> </map:match>
>
> And configured following serializer:
>
> <map:serializer name="p-topic" logger="sitemap.serializer.xml"
> mime-type="text/xml;charset=utf-8" src="org.apache.cocoon.serialization.XMLSerializer">
> <encoding>UTF-8</encoding>
> <doctype-public>-//NXP//DTD P-Topic//EN</doctype-public>
> <doctype-system>${p-topic-dtd}</doctype-system>
> </map:serializer>
>
> The pattern "basictype/*/*/*" generates a DITA topic by transforming the result of an Xquery.
>
> When I invoke http://localhost:8888/topics/basictype/PH3330L/released/pinning_information?drawingExtension=gif in the browser and save the result [1] to filesystem I see that the doctype has been added correctly:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE p-topic PUBLIC "-//NXP//DTD P-Topic//EN" "http://nww.qa.spider.nxp.com:8311/xmetal/schemas/p-topic.dtd">
> <p-topic id="pinning_information">
> ...
> </p-topic>
>
> When I invoke http://localhost:8888/topics/topic2xhtml/basictype/PH3330L/released/pinning_information I would expect the topic to get transformed correctly into XHTML. This does not work however. Just for testing purpose I added [1] in my app into /data/pinning_information.xml and created a new match pattern which reads [1] from disc
>
> But when i now try to invoke http://localhost:8888/topics/topic2xhtml/test the DITA topic does get transformed correctly.
>
> Is there a difference between
> a) calling a pipeline that generates a DITA topic on the fly and serializes it using my custom serializer which is used as input for the
> topic2xhtml/** pattern
> b) reading the DITA topic from filesystem which is used as input for the topic2xhtml/** pattern
>
>
> It looks like the class attributes which should be added by the DTD are not added in use-case (a) which is why the transform fails.
>
> Any insight is appreciated.
>
> Kind regards,
> Robby Pelssers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: problem with serialization Cocoon2.2
Posted by David Crossley <cr...@apache.org>.
Robby Pelssers wrote:
>
> Hi all,
>
> I have a strange situation I don't really understand.
>
> In my sitemap I have following patterns:
>
> <!--
> {1}: basictype-id
> {2}: state
> {3}: topic-id
> -->
> <map:match pattern="basictype/*/*/*">
> <map:generate src="xquery/getTopic.xquery" type="queryStringXquery">
> <map:parameter name="basictypeId" value="{1}"/>
> <map:parameter name="state" value="{2}"/>
> <map:parameter name="topicId" value="{3}"/>
> </map:generate>
> <map:transform src="xslt/postprocessXqueryResults.xslt" type="saxon"/>
> <map:transform src="xslt/urlTransformer.xslt" type="saxon">
> <map:parameter name="contextpath" value="{request:contextPath}"/>
> <map:parameter name="drawingExtension" value="{request-param:drawingExtension}"/>
> </map:transform>
> <map:serialize type="p-topic"/>
> </map:match>
>
> <map:match pattern="topic2xhtml/**">
> <map:generate src="cocoon:/{1}"/>
> <map:transform src="xslt/dita/xslhtml/dita2xhtml.xsl" type="saxon"/>
> <map:serialize type="xhtml"/>
> </map:match>
>
> <map:match pattern="test">
> <map:generate src="data/pinning_information.xml"/>
> <map:serialize type="xml"/>
> </map:match>
>
> And configured following serializer:
>
> <map:serializer name="p-topic" logger="sitemap.serializer.xml"
> mime-type="text/xml;charset=utf-8" src="org.apache.cocoon.serialization.XMLSerializer">
> <encoding>UTF-8</encoding>
> <doctype-public>-//NXP//DTD P-Topic//EN</doctype-public>
> <doctype-system>${p-topic-dtd}</doctype-system>
> </map:serializer>
>
> The pattern "basictype/*/*/*" generates a DITA topic by transforming the result of an Xquery.
>
> When I invoke http://localhost:8888/topics/basictype/PH3330L/released/pinning_information?drawingExtension=gif in the browser and save the result [1] to filesystem I see that the doctype has been added correctly:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE p-topic PUBLIC "-//NXP//DTD P-Topic//EN" "http://nww.qa.spider.nxp.com:8311/xmetal/schemas/p-topic.dtd">
> <p-topic id="pinning_information">
> ...
> </p-topic>
>
> When I invoke http://localhost:8888/topics/topic2xhtml/basictype/PH3330L/released/pinning_information I would expect the topic to get transformed correctly into XHTML. This does not work however. Just for testing purpose I added [1] in my app into /data/pinning_information.xml and created a new match pattern which reads [1] from disc
>
> But when i now try to invoke http://localhost:8888/topics/topic2xhtml/test the DITA topic does get transformed correctly.
>
> Is there a difference between
> a) calling a pipeline that generates a DITA topic on the fly and serializes it using my custom serializer which is used as input for the
> topic2xhtml/** pattern
> b) reading the DITA topic from filesystem which is used as input for the topic2xhtml/** pattern
>
>
> It looks like the class attributes which should be added by the DTD are not added in use-case (a) which is why the transform fails.
>
> Any insight is appreciated.
Is the DTD being resolved and used in both cases?
http://cocoon.apache.org/2.1/userdocs/concepts/catalog.html
Are you using Cocoon's catalog entity resolver to
get a local copy of the DTD? Not that that should
make a difference.
AFAIK the Serializer adds the document type declaration.
It is the next Generator that would resolve and process
the DTD.
At Apache Forrest we have a similar situation. There
are intermediate pipelines that serialise to xml
and add a document type declaration.
When i look at our logs, there are messages about
resolving the DTD for the initial xml source that
is Generated. However there are no DTD resolve messages
for that intermediate pipeline.
I think that this might just be confirming your situation.
-David