cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Götz Botterweck <botte...@uni-koblenz.de>
Subject HOWTO: produce custom xml (not predefined doctypes like HTML) as output
Date Thu, 25 Jan 2001 00:12:07 GMT
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

Mime
View raw message