cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timur Izhbulatov <...@yxo.ru>
Subject Re: Can't get the xml declaration in the output
Date Tue, 12 Oct 2004 12:52:42 GMT
IceT писал(а): 

> Hello, 
> 
>       Every time I output something with Cocoon, it omits the 
> xml-declaration. Can anybody help me?
>       I'm using the latest release of Cocoon, with J2sdk 1.42, windows XP, 
> IExplorer and Mozzila 
> 
>      This is my sitemap: 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> <map:components>
> <map:serializers> 
> 
>  <map:serializer
>    name="xml"
>    mime-type="text/xml; charset=iso-8859-1"
>    src="org.apache.cocoon.serialization.XMLSerializer"
>    pool-max="32"
>    pool-min="16"
>    pool-grow="4"
>  >
>     <encoding>iso-8859-1</encoding>
>     <omit-xml-declaration>no</omit-xml-declaration>
>  </map:serializer> 
> 
>  <!-- configure the HTML serializer to use iso-8859-1 encoding -->
>  <map:serializer
>    name="html"
>    mime-type="text/html"
>    src="org.apache.cocoon.serialization.HTMLSerializer"
>  >
>     <encoding>iso-8859-1</encoding>
>  </map:serializer>
>  <!-- configure the XML serializer to supply "text/html" -->
>  <map:serializer name="html"
>                  mime-type="text/html; charset=utf-8"
>                  logger="sitemap.serializer.html"
>                  pool-grow="2" pool-max="64" pool-min="2"                  
>               src="org.apache.cocoon.serialization.XMLSerializer">
>    <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
>    
> <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype 
> -system>
>    <!-- No XML declaration to force M$-InternetExplorer into standards 
> compliant mode -->
>    <omit-xml-declaration>no</omit-xml-declaration>
>    <omit-namespaces>yes</omit-namespaces>
>    <encoding>UTF-8</encoding>
>    <indent>yes</indent>
>  </map:serializer> 
> 
> </map:serializers> 
> 
> </map:components>
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="helloworld">
> <map:generate src="helloworld.xml"/>
> <map:transform src="helloworld2html.xsl"/>
> <map:serialize type="xml"/>
> </map:match>
> <map:match pattern="*.css">
> <map:read src="estilo.css" mime-type="text/css"/>
> </map:match>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap> 
> 
> 
> And the output 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 
> Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <link type="text/css" href="estilo.css" rel="STYLESHEET">
> </head>
> <body>
> <h1>Hello World</h1>
> </body>
> </html> 
> 
>  
> 
> The xsl: 
> 
> 
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
> 
> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"
>         omit-xml-declaration="no"
>                 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
>                 
> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/> 
> 
> <xsl:template match="document">
> <html>
> <head>
> <link rel="STYLESHEET" href="style.css" type="text/css"/>
> </head>
> <body>
> <h1><xsl:value-of select="text"/></h1>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>

You have two serializers with the same name. I think you should remove one 
of them, probably the second one. 

Also, the output is not XML but HTML and, AFAIK, it cannot contain the XML 
declaration because it is not a valid XML document. I have no idea why it is 
not XML since you explicitly set the serialization type to "xml". 

Timur

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message