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

Thomas Henry Sutton thsutton at utas.edu.au
Thu Sep 23 03:26:08 CEST 2004


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  
PCDATA):
	<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?

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?

Finally: we are using libxml2 and libxslt because we had to abandon  
4Suite due to instability. Are there known problems with using 4Suite  
with ModPython and Apache 2? We had a range of problems (complaining  
about the expat version 'til we recompiled Apache, Apache SEGFAULTing  
when trying to do XSLT processing, etc) which suggest to me at least  
that there are some problems with the way 4Suite does things.

Cheers,
Thomas Sutton



More information about the XML-SIG mailing list