[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Associating javascript with XSL and XML


Subject: Re: [xsl] Associating javascript with XSL and XML
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 5 Jan 2010 13:25:27 GMT

> Little known factoid: the html, body and head opening and closing tags
> are all optional.

with restrictions on when they can be omitted, but that is for html,
they are not optional in xhtml which is what you are generating here.
(And if you want the thing to work in IE it's best to generate html, or
as second best, unprefixed xhtml)

David


<xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:h="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
        <h:script type="text/javascript">
                alert('hello');
        </h:script>
        <h:style type="text/css">
                a{background-color:red}
        </h:style>
<xsl:apply-templates />
</xsl:template>


Current Thread
Keywords