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 Geissler <M....@wika.de> on 2001/01/25 07:42:06 UTC
Antw: HOWTO: produce custom xml (not predefined doctypes like
HTML) as output
Another Idea:
Try the <xsl:output/> - Tag
Martin
>>> botterwe@uni-koblenz.de Donnerstag, 25. Januar 2001 01:12:07 >>>
WHAT I WANT TO DO
I want to have cocoon producing a xml document as output which is of an
custom document type. For an example we can assume I want to produce an
docbook article => The output should look somewhat like this
<!DOCTYPE article PUBLIC "-//Norman Walsh//DTD DocBk XML
V3.1.4//EN"
"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
<article>
<section>bla</section>
</article>
Of course I know how to produce contents like <tag>bla</tag> with an XSL
transformation. But how do I put that DOCTYPE in front of the article
element (when using Cocoon)?
IDEA 1
Use <![CDATA[ ]]> to output raw text, somewhat like this
<xsl:template match="some_root_pattern">
<![CDATA[
<!DOCTYPE article PUBLIC "-//Norman Walsh//DTD DocBk XML
V3.1.4//EN"
"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
]]>
<article>
...
</article>
</xsl:template>
but then I receive an error
org.apache.xalan.xslt.XSLProcessorException: Warning: can't
output text before document element! Ignoring...
at
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1674)
IDEA 2
I have seen the document type in the cocoon.properties file.
Would it be an option to add a new document type to cocoon properties
somewhat like this
# DocBook
formatter.text/html/loose.doctype-public = -//Norman Walsh//DTD DocBk
XML V3.1.4//EN
formatter.text/html/loose.doctype-system =
http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd
formatter.text/html/loose.MIME-type = text/docbook
And then use a processing instruction like this
<xsl:processing-instruction
name="cocoon-format">type="text/docbook"</xsl:processing-instruction>
Any hints? TIA!
Goetz
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>