Re: [xml] htmlDocDumpMemory() vs xmlDocDumpMemory()




On Mar 2, 2009, at 12:14 AM, Tim Van Holder wrote:

Rush Manbert wrote:
Hi Julien,
Rush, have you specified a doctype in your html file? Have you checked
how other browsers behave?

Here is a sample of rendered output, using htmlDocDumpMemory():

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"; lang="en-US" xml:lang="en-US">

Like Julian said, the doctype is going to be an issue.
Are you specifying 'html' as the output method in your XSL? If so,
that's the likely culprit.
Instead, try setting up your <xsl:output> (or exsl:document) to generate
"real" XHTML:

 <xsl:output method="xml" version="1.0" encoding="utf-8"
    omit-xml-declaration="no" media-type="application/xhtml+xml"
    doctype-public="-//W3C//DTD XHTML 1.1//EN"
    doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>

This should (hopefully) avoid any quirks mode in browsers.


Hi Tim,

I probably shot myself in the foot, in 2 separate steps that occurred about 12 months apart.

I am using libxml and libxslt in a cross-platform sort-of-a-browser. My initial development was using webkit on the Mac, then I tried to implement it on Windows using the IE browser control. That's probably when I changed by XSLT stylesheet's xsl:output statement to specify html output.

I tried using the xsl:output statement that you provided, along with xmlDocDumpMemory, and I get beautifully formatted XHTML with the proper doctype declaration and it avoids quirks modes on all the browsers I previously tested with (even IE 7).

Thank you very much,
Rush



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