RE: [xslt] whitespace around IMG tag



I do not complain of IE here. I'm asking whether the behaviour of libXSLT is ok when adding newline between <img> and </div> when indenting output. 
>From my example 

<div><img /></div>

is transformed correctly as

<div><img></div>

but 

<div><img /><img /></div>

is transformed as

<div>
<img><img>
</div>

see the extra newlines, which I guess is not correct.

Marek


-----Original Message-----
From: Jesse Pelton [mailto:jsp@PKC.com] 
Sent: Wednesday, June 04, 2003 4:42 PM
To: 'xslt@gnome.org'
Subject: RE: [xslt] whitespace around IMG tag

What IE is doing is appropriate. It sees white space in element context, so
it renders it. White space between attributes in a tag will be ignored, and
multiple white space characters in content are compressed to a single space
(except in <PRE> elements, I think), but otherwise white space is rendered.
(Note that this is a simplification; see the spec for the complete rules.)

The bottom line, though, is simple: unless you want white space rendered,
don't include it.

Are you saying that the following HTML does not result in whitespace being
rendered?

<div>
<img>
</div>

If so, that seems wrong. Furthermore, I'd expect whitespace before and after
the image, not just after. For what it's worth, I tend to rely on Mozilla's
interpretation of the standards, because it seems to have the best and most
complete (though still not perfect) implementation.

> -----Original Message-----
> From: Novický Marek [mailto:novicky@aarongroup.cz]
> Sent: Wednesday, June 04, 2003 10:29 AM
> To: xslt@gnome.org
> Subject: [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 
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt@gnome.org
http://mail.gnome.org/mailman/listinfo/xslt




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