Re: [xslt] libxslt bug?



On 18/07/2008, Kyle Butt <kylebutt gmail com> wrote:
> I am noticing the following annoying behavior:
>  libxslt is giving an opening and closing tag for <br> instead of a single <br>
>  tag in html output mode. The browser interprets this as 2 line breaks, which is
>  not what I want. Any suggestions or pointers would be useful.

Firstly, the xhtml namespace is http://www.w3.org/1999/xhtml - where
did you get http://www.w3.org/TR/xhtml1/strict from? Using the wrong
namespace will prevent the page from being displayed correctly if you
ever serve it as an xml mime type.

Second, you want the following output element for XHTML 1.0 Strict,
not the one you are using:
<xsl:output omit-xml-declaration="yes" indent="yes"
		doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
This will use the the html compatible serialisation as given at
http://www.w3.org/TR/xhtml1/#guidelines - and note, no
encoding="utf-8" (that's the default anyway) or method="html" (this,
combined with the wrong namespace, was your problem).

Third, you need to make sure you're not using the c14n functions to
save an result documents.

I've attached a working replacement for your example.xsl - notice the
other additions to the output.

In summary, there's no libxslt bug here.

Martin


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