Some XHTML tags must be serialized using short notation, namely, <area />, <bgsound />, <br />, <hr />, <img />, <input />, and <param />.
The Saxon serializer (at least for .NET) always uses long notation, e.g., <br></br>. The browser DOM does not properly parse this notation. It interprets it as two BR tags.
This is the test case added to the XsltExamples provided with the Saxon project.
ExampleSimple1(dir + "xml/cities.xml", dir + "xsl/xhtml2b.xsl");
The xhtml2b.xsl file is attached.
This is the result.
<html>
<title>Test XHTML Output</title>
<body>
<p>Hello World
<br></br>
<img src="world.gif"></img>
</p>
<ul>
<li>Bonjour (France)</li>
<li>Hola! (Spain)</li>
<li>Grüß Gott (Austria)</li>
<li>Hyvää päivää (Finland)</li>
<li>Ciao (Italy)</li>
<li>Hi (England)</li>
</ul>
<hr></hr>
<div id="bottomPanel"></div>
</body>
</html>
It should be:
<html>
<title>Test XHTML Output</title>
<body>
<p>Hello World <br /><img src="world.gif" /></p>
<ul>
<li>Bonjour (France)</li>
<li>Hola! (Spain)</li>
<li>Grüß Gott (Austria)</li>
<li>Hyvää päivää (Finland)</li>
<li>Ciao (Italy)</li>
<li>Hi (England)</li>
</ul>
<hr />
<div id="bottomPanel"></div>
</body>
</html>
Note: the indentation is wrong too, but setting indent="no" in the XSLT resolves the problem by not indenting anything--not pretty, but at least it doesn't insert text nodes where they don't belong.
Sample XSLT showing serialization problem