[xslt] whitespace around IMG tag



Hi All,

I'm running into trouble when using HTML output with INDENT turn on.

A template 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<body>
<div><img /></div>
<div><img /><img /></div>
<div><img /><img /><img /></div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

would produce following output:

<html><body>
<div><img></div>
<div>
<img><img>
</div>
<div>
<img><img><img>
</div>
</body></html>

The problem is that IE takes those newline between <img> and </div> as a textnode, rendering some extra space around image.

I know that similar problem has been discussed before and it works fine when using a single <img> (inline) tag inside <div>, <td> and other block tags.

I also know I can turn off indenting in output, which helps.

I wonder, whether this behavior is correct and if yes, whether is there any other workaround to solve the problem.

Thanks

Marek



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]