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

Subject: Re: [xsl] PHP XSL adds Content-Type meta
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 08 May 2007 10:58:37 +0200
It seems unlikely that libxsl is adding elements to your output, no xslt processor is allowed to add elements unless you specify it to do so, and you don't do that in the xsl:output instruction.

You choose an output method of type 'xml', which may be served to the output stream as 'text/xml' content type (which is different from adding a 'meta' element). The receiver of the output (probably your script, or PHP in the first place) can then take additional actions (i.e., I know of Apache configurations where the content type is added automatically, based on file extension, but I never used such configurations, I rather use the HTTP headers).

Even if the 'meta' element disappears from your output when you remove xsl:output (or change its signature), then I'd still research the bug inside your PHP script (somehow your script or configuration may act upon the doctype to add the meta element???).

To test whether your output from the script equals the output from libxslt, you'd have to try it from the commandline. In addition, you can compare the output by running it with another processor, i.e. Saxon 6.5 (for XSLT 1.0) for differences.

Cheers,
-- Abel Braaksma

Martynas Jusevicius wrote:
Hi all,

I'm using PHP's XSL extension (which uses libxsl, AFAIK).
When I specify

   <xsl:output method="xml" encoding="UTF-8" indent="yes"
   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>

the processor adds

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

to the output. This is not needed, because the encoding is not known
at this point and negotiated later according to the HTTP headers. For
the same reason I cannot specify it directly in the <xsl:output>.
Is it possible to turn this feature (bug?) off?

Thanks,

Martynas

Current Thread