html


Say you create XHTML from XML using XSLT transformation (like me from Docbook to XHTML chunks using Docbook XSLT Stylesheets ) and you want to include some Javascript in the XHTML output.

If you serve your XHTML pages with mime-type: application/xhtml+xml rather then text/html , you will have to take care of xml-relevant characters within the script code (see Javascript and XHTML for a short explanation):

<script type="text/javascript">
/* <![CDATA[ */
// content of your Javascript goes here
/* ]]> */
 
or 
 
<script type="text/javascript">
// <![CDATA[ 
 content of your Javascript goes here
//]]>
</script>

Generating this output with xslt can be a little bit tricky. My solution (probably better exist) uses a trick shown in http://www.w3.org/TR/xslt#section-XML-Output-Method:

... xslt code ...
<script type="text/javascript">
	<xsl:text disable-output-escaping="yes">
	<![CDATA[//<![]]><![CDATA[CDATA[]]>
//javascript
	<![CDATA[//]]><![CDATA[]]]]><![CDATA[>]]>
        </xsl:text>
</script>
... xslt code

Was playing arround with CSS. Especially with dynamic style settings like :hover. I  was naiv enough to use just a simple
<html><head> as a header for my experimental page. It made me wonder why Firefox 2 would not handle div:hover correctly, because Opera and Konquerer did. Finally changed the header to

<!DOCTYPE html PUBLIC “-//W3C//DTD XHMTL 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”>

… and now it works.