You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Koch <ko...@pixelpark.com> on 2000/12/22 13:39:33 UTC
cocoon-format type="text/xhtml"
Hi there,
Cocoon Version: 1.8
Servlet: Tomcat Web Server/3.2.1
Why does the text/xhtml formatter does not indent the way the text/html
formatter does?
cocoon.properties:
# HTML 4.0 (strict)
formatter.text/html.MIME-type = text/html
formatter.text/html.encoding = iso-8859-1
formatter.text/html.doctype-public = -//W3C//DTD HTML 4.0//EN
formatter.text/html.doctype-system =
http://www.w3.org/TR/REC-html40/strict.dtd
#formatter.text/html.preserve-space = true
#formatter.text/html.line-width = 72
#formatter.text/html.indent = 2
# XHTML 1.0 (strict)
formatter.text/xhtml.MIME-type = text/html
formatter.text/xhtml.encoding = iso-8859-1
formatter.text/xhtml.doctype-public = -//W3C//DTD XHTML 1.0 Strict//EN
formatter.text/xhtml.doctype-system =
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
formatter.text/xhtml.preserve-space = true
formatter.text/xhtml.line-width = 72
formatter.text/xhtml.indent = 2
Example:
xml-file:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?cocoon-process type="xslt"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<h1>Überschrift</h1>
<p>Absatz</p>
<div>
<div>div in div</div>
</div>
</body>
</html>
xsl-file:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:processing-instruction name="cocoon-format">
<xsl:text>type="text/xhtml"</xsl:text><!-- or text/html -->
</xsl:processing-instruction>
<xsl:apply-templates select="*|@*|text()"/>
</xsl:template>
<xsl:template match="*|@*|text()">
<xsl:copy>
<xsl:apply-templates select="*|@*|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
output (text/xhtml):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<title>Test</title> </head> <body> <h1>Überschrift</h1>
<p>Absatz</p> <div> <div>div in div</div> </div> </body>
</html>
<!-- This page was served in 2126 milliseconds by Cocoon 1.8 -->
output (text/html):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<h1>Überschrift</h1>
<p>Absatz</p>
<div>
<div>div in div</div>
</div>
</body>
</html>
<!-- This page was served in 1943 milliseconds by Cocoon 1.8 -->
Another point: Why does the text/xhtml formatter write
"<!DOCTYPE HTML ..."
instead of
"<!DOCTYPE html"?
--
Johannes Koch . IT Developer
Pixelpark AG . http://www.pixelpark.com
Rotherstraße 8 . 10553 Berlin . Germany
phone: +49 30 5058 - 1288 . fax: - 1355