Re: [xsl] PHP XSL adds Content-Type meta

Subject: Re: [xsl] PHP XSL adds Content-Type meta
From: Abel Braaksma <>
Date: Tue, 08 May 2007 12:56:47 +0200
Michael Kay wrote:
XSLT 1.0 specifies that when you use the HTML output method, the serializer
will add a <meta> element containing the media type and encoding. This
normally causes no problems, because the encoding is known at this point
(it's the responsibility of the serializer to get it right). XSLT 2.0
however does allow you to switch this behaviour off using <xsl:output
include-content-type="no"> - this can be useful if you want to transcode the
document after serialization and before HTTP delivery.

Your snippet suggests you are using method="xml"; if that's the case then no
<meta> element should be added.

Ah, my apologies for supplying incorrect or incomplete information.
So, it appears to be a libxsl bug after all: using doctype and method='xml' causes libxsl to incorrectly output the <meta> element.

Interestingly, there's another oddity. You specify that the output contains an extra:

<meta http-equiv="Content-Type" ... />

whereas, when the output is considered html (as libxsl seems to think), it should output:

<meta http-equiv="Content-Type" ... >

instead (no closing tag or slash). So, as it is, the libxsl processor is mixing xml and html: it adds an element that should be added in html mode, and it leaves the tags as in xml: nicely closed, even when these are empty tags and should be output without end-tag.

IMHO, this is an libxsl feature, not a bug: it recognizes XHTML doctype and outputs all elements as XML (with closing tags) and adds the <meta> as it would do with html. But it is not what it should do, of course.

-- Abel

Current Thread