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