Output method html not closing empty tags

Brecht Yperman <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <1E098AAC02A0184BAE8048243106CBF92F5FD12D5A@hpserver2.office.invenso.com>
Hi,

We have an externally generated XSLT which we use for a transformation using Xalan.

The result however is not as expected.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="fn link xbrldi xbrli xdt xlink xs xsi">
                <xsl:output version="4.0" method="html" indent="no" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
                <xsl:param name="SV_OutputFormat" select="'HTML'"/>
                <xsl:variable name="XML" select="/"/>
                <xsl:template match="/">
                               <html>
                                               <body style="margin-left=0.6in; margin-right=0.6in; margin-top=0.79in; margin-bottom=0.79in">
                                                               <img>
                                                                              <xsl:attribute name="src">
                                                                                              <xsl:text>file:///</xsl:text>
                                                                              </xsl:attribute>
                                                               </img>
                                               </body>
                               </html>
                </xsl:template>
</xsl:stylesheet>

This results in the following output:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:altova="http://www.altova.com"><body style="margin-left=0.6in; margin-right=0.6in; margin-top=0.79in; margin-bottom=0.79in"><img src="file:///"></body></html>

As you can see the <img/> tag is not well formed, and we'd like to have XHTML.

The result is OK when we use <xsl:output method="xml" />, but we don't have control over the stylesheet.

I drilled it down to line 1011 of ./trunk/src/org/apache/xml/serializer/ToHTMLStream.java

What's the reason for this not to be:
writer.write('/>');
?
Thanks,
Brecht
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.