Subject: Re: [xsl] PHP XSL adds Content-Type meta|
From: "Martynas Jusevicius" <martynas.jusevicius@xxxxxxxxx>
Date: Tue, 8 May 2007 11:41:23 +0200
That is what though -- that content-type meta should be added with method="html" but not method="xml". I found an older thread on that: http://www.mail-archive.com/xslt@xxxxxxxxx/msg00783.html However I am indeed using method="xml" and still get the meta, even with command line xsltproc (just checked). A specific stylesheet includes the "master" stylesheet which then contains the <xsl:output>, but I guess that should not matter.
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