Hi,

I have experienced something similar.

I had
<tag>
  <xsl:choose>
  .....
  </xsl:choose>
</tag>

In the situations where no output was generated between <tag> and </tag>
then Xalan would suppress writing </tag> to the result tree.

I fixed those specific situations by adding:
<xsl:text> </xsl:text>
before just before </tag>

Best regards
Christoffer Bruun

Brecht Yperman wrote:
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

Reply via email to