Explicit script end tag always converted to self-closing

Posted by Jonas on Stack Overflow See other posts from Stack Overflow or by Jonas
Published on 2008-12-03T09:49:27Z Indexed on 2010/04/04 0:43 UTC
Read the original article Hit count: 558

Filed under:
|

I'm using xslt to transform xml to an aspx file. In the xslt, I have a script tag to include a jquery.js file. To get it to work with IE, the script tag must have an explicit closing tag. For some reason, this doesn't work with xslt below.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
    xmlns:asp="remove">    
    <xsl:output method="html"/>
    <xsl:template match="/">
        <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <title>TEST</title>
                <script type="text/javascript" src="jquery-1.2.6.js"></script>

But if I change the script tag as shown below, it works.

        <script type="text/javascript" src="jquery-1.2.6.js">
            // <![CDATA[ // ]]>
        </script>

I thought that the <xsl:output method="html" /> would do the trick, but it doesn't seem to work?

/Jonas

© Stack Overflow or respective owner

Related posts about xslt

Related posts about JavaScript