Re: [xslt] Removing <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> from html output

You mean xsltproc adds the line only for html but not for xml output,
right Daniel?

Using the following snippet of XML:

<?xml version="1.0" encoding="UTF-8"?>
   <pet type="cat">Max</pet>
   <pet type="parrot">Peter</pet>

If I then apply a minimal stylesheet with output set to html:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="";>

 <xsl:output method="html"  indent="yes" />

 <xsl:template match="/">


You'll see the following html output:

<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>

Notice the meta tag is added, and not by the stylesheet but by the XSL

Now if we just change the output in the stylesheet to xml:

 <xsl:output method="xml" indent="yes" />

We get the following output:

<?xml version="1.0"?>

Sounds like there is no way to turn off the meta tag for html output
(and still have a head tag) so I'll look at making xml output work.


On 1/2/07, Daniel Veillard <veillard redhat com> wrote:
On Tue, Jan 02, 2007 at 03:12:16PM -0500, T.G. Mutato wrote:
> It appears that xsltproc automatically adds the line
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> to html output.

  only on XHTML-1.0 output, not on html output which is something completely
different in XSLT . I suggest you consult:
    - section 16.1 of the XSLT-1.0 spec
    - Appendix C 9 of the XHTML-1.0 spec:

Either don't generate the XHTML1 doctype or post-process the output.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine
xslt mailing list, project page
xslt gnome org

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