On Tue, Jan 02, 2007 at 10:54:40PM -0500, T.G. Mutato wrote: > You mean xsltproc adds the line only for html but not for xml output, > right Daniel?
Not really but I was wrong, see below :-) > Using the following snippet of XML: > > <?xml version="1.0" encoding="UTF-8"?> > <pets> > <pet type="cat">Max</pet> > <pet type="parrot">Peter</pet> > </pets> > > 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="http://www.w3.org/1999/XSL/Transform"> > > <xsl:output method="html" indent="yes" /> > > <xsl:template match="/"> > <html> > <head> > </head> > <body> > </body> > </html> > </xsl:template> > > </xsl:stylesheet> > > You'll see the following html output: > > <html> > <head><meta http-equiv="Content-Type" content="text/html; > charset=UTF-8"></head> > <body></body> > </html> > > Notice the meta tag is added, and not by the stylesheet but by the XSL > processor. > > 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"?> > <html> > <head/> > <body/> > </html> > > 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. I checked the code and yes the meta tag is added automatically if method is 'html'. It's actually required by the spec in that case, see section : http://www.w3.org/TR/xslt#section-HTML-Output-Method "If there is a HEAD element, then the html output method should add a META element immediately after the start-tag of the HEAD element specifying the character encoding actually used." So I guess the behaviour is right. I though this was done only for XHTML-1.0 output by libxml2, but in that case it's different, it's actually normal to do it for html output I had forgotten about this. XML processing in general is more stricly defined, it's better to use that as the target format. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ [email protected] http://mail.gnome.org/mailman/listinfo/xslt
