J
Jesper Moth
The MSXML4 xslt-parser would output any source <div/> like this:
<div></div>
I never figured out how to disable this behaviour. But since it makes the
source document look cleaner, and since most browsers require empty divs to
be markup up this way, I didn't really give it an extra thought untill I
moved to the Tomcat 4.1 where the *reverse* situation applies. The native
xslt-parser outputs any <div></div> like this:
<div/>
- effectively misrendering the page in certain important browsers. And it's
not just the content of the source document that outputs like this; it's
also the content of the templates themselves:
<xsl:template match="/">
<div>
<h1>Hello</h1>
<div></div> <!-- this becomes <div/> in output -->
<div>
<xsl:template>
My first thought was to change the output method to HTML, but amazingly
this didn't change anything; and I would also like to avoid this. I have no
idea on how to go about this and I can't figure out how the spec is
supposed to be read on this subject. What I would like is to have my
source-file <input/> elements and my <div></div> elements rendered exactly
like that [transforming xhtml2 to xhtml1]. Here is my output tag:
<xslutput
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
method="xml"
encoding="UTF-8"
omit-xml-declaration="no"
indent="yes" />
<div></div>
I never figured out how to disable this behaviour. But since it makes the
source document look cleaner, and since most browsers require empty divs to
be markup up this way, I didn't really give it an extra thought untill I
moved to the Tomcat 4.1 where the *reverse* situation applies. The native
xslt-parser outputs any <div></div> like this:
<div/>
- effectively misrendering the page in certain important browsers. And it's
not just the content of the source document that outputs like this; it's
also the content of the templates themselves:
<xsl:template match="/">
<div>
<h1>Hello</h1>
<div></div> <!-- this becomes <div/> in output -->
<div>
<xsl:template>
My first thought was to change the output method to HTML, but amazingly
this didn't change anything; and I would also like to avoid this. I have no
idea on how to go about this and I can't figure out how the spec is
supposed to be read on this subject. What I would like is to have my
source-file <input/> elements and my <div></div> elements rendered exactly
like that [transforming xhtml2 to xhtml1]. Here is my output tag:
<xslutput
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
method="xml"
encoding="UTF-8"
omit-xml-declaration="no"
indent="yes" />