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

Subject: RE: [xsl] PHP XSL adds Content-Type meta
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 8 May 2007 10:31:40 +0100
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.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Martynas Jusevicius [mailto:martynas.jusevicius@xxxxxxxxx] 
> Sent: 08 May 2007 09:44
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] PHP XSL adds Content-Type meta
> 
> 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