Including javascript files in HTML output

Subject: Including javascript files in HTML output
From: "Carlson, Thor" <CarlsonT@xxxxxxx>
Date: Wed, 21 Jun 2000 08:28:37 -0400
Problem: I'm trying to include a JavaScript file "validate.js" in my HTML
output but IE5 is reporting a syntax error.  No error exists when I hard
code the JavaScript in the stylesheet.  The following is simplified for

Given the following XML fragment:


And the following stylesheet fragment:

    <xsl:for-each select="SCRIPT">
        <SCRIPT LANGUAGE="JavaScript">
            <xsl:attribute name="SRC">
                <xsl:value-of select="."/></xsl:attribute>//need

My generated html result is:

    <SCRIPT LANGUAGE="JavaScript" SRC="validate.js">//need this</SCRIPT>

(I need to include the "//need this" without which the browsers do not
generate the closing </SCRIPT> tag, resulting in the display of an empty

My problem is the IE5 browser reports a syntax error.  The generated HTML is
correctly formed.  When the .js file contents are directly pasted into the
stylesheet, the syntax error is not reported.

Sample validate.js file:

    <xsl:text disable-output-escaping="yes">
    <!-- hide javascript from older browsers
    function validate(form)
        alert ('validate()!');

Can anyone explain how to successfully include .js files?

Thank you.

- Thor

Thor Carlson
Dun & Bradstreet
973.605.6095 voice
973.605.6957 fax

 XSL-List info and archive:

Current Thread