[XML-SIG] Generating XHTML with XSLT using the libxml2/libxslt bindings

Daniel Veillard veillard at redhat.com
Thu Sep 23 11:58:24 CEST 2004

On Thu, Sep 23, 2004 at 11:26:08AM +1000, Thomas Henry Sutton wrote:
> Hi all,
> I'm doing a project that uses libxml2 and libxslt to generate XHTML  
> documents using XSLT style sheets. In our XSLT we have something like:
> 	<script type="text/javascript" src="menu.js">
> 		// Some stuff
> 	</script>
> If we use the doctype-public and doctype-system attributes on the  
> xsl:output element like so:
> 	<xsl:output method="xml" indent="yes"
> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1- 
> transitional.dtd"
> 	    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
> the XSLT parser insists on making the text within the <script> a CDATA  
> section (in spite of the XHTML spec saying the <script> elements a  
> 	<script type="text/javascript" src="menu.js"><![CDATA[
> 		// Some stuff
> 	//></script>
> We need to both include script text within the output document and  
> `include' external JS files (using an src attribute or whatever). For  
> some reason, we just can't get it to work (in a browser) without  
> removing the doctype-public and doctype-system attributes from  
> <xsl:output>. Does anyone have any suggestions?
  It does it because the spec suggests it:

> Also: for some reason the XSLT processor modifies the content attribute  
> of a <meta> element (that is specified in the XSLT):
> 	<meta http-equiv="Content-Type" content="application/xhtml+xml"/>
> if turned into:
> 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> How do I make it stop and why is it doing it?

  That's also what the spec suggests:
but I agree overriding the content type is problematic, it should just fix
the charset, that should be fixed.
  Anyway proper place to discuss this and report libxml2 bugs is not this
list, see http://xmlsoft.org/bugs.html


Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

More information about the XML-SIG mailing list