Hi Rush,

> Here is a sample of rendered output, using htmlDocDumpMemory():
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Ok, so here is the line that causes your troubles. This doctype puts
the document in quirks mode. Switching to the following version (the
strict HTML 4.0 doctype) should solve your issue.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">

It may be even better to drop the end and use instead
<!DOCTYPE HTML>

It is what HTML5 requires (see
http://www.whatwg.org/specs/web-apps/current-work/#the-doctype).

> <html xmlns="http://www.w3.org/1999/xhtml"; lang="en-US" xml:lang="en-US">
> <!--Template match for /x:html/x:head-->
> <head><base
> href="file://localhost//Users/rmanbert/development/libxmlRendering/client/pace/demos/iml/imlDemoV0_1/">
> <!--No imltemplate file, or no x:imltemplatehead.-->
> <!--Processing $docHeadContent directly-->
> <title>RenderingTestPage</title></head>
> <!--Template match for /x:html/x:body-->
> <body><!--No imltemplate file, or no x:imltemplatebody.-->
> <!--Processing $docBodyContent directly-->
> <p>Line 1</p><i>Line 2</i><p> Line 3: This comes before a XML-legal "br"
> element<br></br>Line 4: And this comes immediately after it</p><img
> src="file://localhost//Users/rmanbert/development/libxmlRendering/client/pace/demos/iml/imlDemoV0_1/images/engChurchill.jpg"></img></body>
> </html>
>
> I didn't clean it up at all, so it has a bunch of trace output that my XSL
> processing inserts. I have a doctype that seems to be inserted by libxml. My
> doctype declaration in the XHTML source specifies my own DTD, which is an
> extension of XHTML. I also tried changing it to this:
>        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "DTD/xhtml1-strict.dtd" >
> but the rendered output has the same doctype declaration shown above,
> whether I use htmlDocDumpMemory() or xmlDocDumpMemory().

I just looked at the libxml documentation and I did not find a way to
set the doctype declaration. It may be a good enhancement especially
for HTML document.

> I tried loading this from a file with Safari and Firefox on the Mac and IE
> and Firefox on Windows. They all treat the </br> as <br>, and output an
> extra blank line, but only Safari said anything about it on the console.

So it is not a bug but a compatibility hack :-)

> I'm afraid that I lied about the <p></p>. They are fine with that. However,
> Safari also complained about the </img>, while no one else does (but it
> displayed the image).

As long as it is only warning, it is fine.


[removed some text and the xml version]

> And here is the output of diff xml html:
>
> 1,2c1
> < <?xml version="1.0" encoding="utf-8" standalone="yes"?>
> < <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">
> ---
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> 5c4,5
> < <head><base
> href="file://localhost//Users/rmanbert/development/libxmlRendering/client/pace/demos/iml/imlDemoV0_1/"/><!--No
> imltemplate file, or no x:imltemplatehead.-->
> ---
>> <head><base
>> href="file://localhost//Users/rmanbert/development/libxmlRendering/client/pace/demos/iml/imlDemoV0_1/">
>> <!--No imltemplate file, or no x:imltemplatehead.-->
> 11c11
> < <p>Line 1</p><i>Line 2</i><p> Line 3: This comes before a XML-legal "br"
> element<br/>Line 4: And this comes immediately after it</p><img
> src="file://localhost//Users/rmanbert/development/libxmlRendering/client/pace/demos/iml/imlDemoV0_1/images/engChurchill.jpg"/></body>
> ---
>> <p>Line 1</p><i>Line 2</i><p> Line 3: This comes before a XML-legal "br"
>> element<br></br>Line 4: And this comes immediately after it</p><img
>> src="file://localhost//Users/rmanbert/development/libxmlRendering/client/pace/demos/iml/imlDemoV0_1/images/engChurchill.jpg"></img></body>
>

There is a few differences: the empty tags that get split and the XML
declaration. It is mostly a difference at the browser's end on how to
handle HTML vs XHTML.

I see an issue with the doctype declaration for the XHTML document
which is set to an HTML one.

> To me, the XHML output looks to be better behaved and it sounds like your
> recommendation would be to keep my output as XHTML.

If you just want to test your output in a browser then XHTML is fine
(which is what I thought you were trying) and will not require much
effort so I would go for it.
If you need to ship for all browsers, then it will not do as Internet
Explorer does not support XHTML.

Regards,
Julien
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to