You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Steinar Eriksen <st...@fikse.net> on 2001/03/06 09:05:35 UTC
Cocoon - converting XML to plain text
I have a system that outputs data through Cocoon to a web browser. As an
additional output channel I would like to send data out as a plain text
file (delimited); but using Cocoon / XSLT to translate this form the
original XML data file.
I am having problems with this, getting the famous error...
"org.apache.xalan.xslt.XSLProcessorException: Warning: can't output text
before document "
Anyway around this ? Here are sample XML and XSL files I have used to
test outputting to text,.
<?xml version="1.0"?>
<?xml-stylesheet href="sre.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<a>
<b>
first
</b>
<c>
second
</c>
</a>
--------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="a">
<xsl:processing-instruction
name="cocoon-format">type="text/plain"</xsl:processing-instruction>
<xsl:value-of select="b"/>
</xsl:template>
</xsl:stylesheet>
fikse.net as
Steinar Rune Eriksen
system architect / business analyst
(+47) 90 52 81 48 / 22 00 45 74
steinar.eriksen@fikse.net
http://www.fikse.net
<?xml version="1.0"?>
<?xml-stylesheet href="sre.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<a>
<b>
first
</b>
<c>
second
</c>
</a>
--------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="a">
<xsl:processing-instruction
name="cocoon-format">type="text/plain"</xsl:processing-instruction>
<xsl:value-of select="b"/>
</xsl:template>
</xsl:stylesheet>