xsl-list
[Top] [All Lists]

[xsl] Best approach for adding Java Script?

2009-02-09 11:07:50
Hello Xsl-list,

Using Xml v1 & Xsl v1
Pulling Xml From a database
Using Xsl to build Xhtml page (v1 or v1.1)

I have a template that adds meta to the head (Works Fine)

e.g.
<xsl:template  name="meta">
        <meta http-equiv="Content-Type" content="text/html; 
charset=application/xhtml+xml; charset=UTF-8" ></meta>
        <meta http-equiv="Content-Language" content="en-GB" ></meta>
        <meta http-equiv="Script-Content-Type" content="text/javascript"></meta>
        <meta http-equiv="Content-Style-Type" content="text/css"></meta>
        
        <meta name ="author" content="Arthur Maloney"></meta>
        <meta name ="distribution" content="Global"></meta>
        <meta name ="generator" content="M5PC77"></meta>
...
</xsl:template>

What is the best way?
1.  To add a comment (AS below lt IE7)
2.  Embed Java Script inside the head element(example below)?

<!--Code Head Element
<head>

    <!--[if lt IE 7]>
    <link rel="stylesheet" href="styles/ie6.css" type="text/css" />
    <![endif]-->

<script type="text/javascript">
        startList = function() {
        if (document.all && document.getElementById) {
                navRoot = document.getElementById("nav");
                for (i = 0; i < navRoot.childNodes.length; i++) {
                                node = navRoot.childNodes[i];
                                if (node.nodeName == "li") {
                                        node.onmouseover = function() {
                                                this.className += " over";
                                                }
                                node.onmouseout = function() {
                                        this.className = 
this.className.replace(" over", "");
                                        }
                                }
                }
        }
}
        
startList();
</script> 
</head>

-- 
Best regards,
 Arthur                          mailto:ArthurM(_at_)seipas(_dot_)com


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--