This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Javascript looping expression in stylesheet


Hi, 
I am going to include a javascript inside the stylesheet. It works in 
some javascripts. But, it fails when I try to use for function. 
some charactures can't escape such as for (var i = 1; i <= nom; i++) {}
It fails in = sign or & sign. any ideas? Thanks. 

--Zoe

<!-- xsl file -->
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
        version='1.0'
        xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
        extension-element-prefixes="java redirect"
        xmlns:java="http://xml.apache.org/xslt/java";>
        
<xsl:output method="html"/>

<xsl:template match="/">

<html>
<head>

<!-- load the javascript file -->
<script language="JavaScript1.2">
        <xsl:comment>
                <xsl:call-template name="js" />
                <xsl:text> // </xsl:text>
        </xsl:comment>
</script>
</head>
<body>
...
</body>
</html>

</xsl:template>

<xsl:template name="js">
<xsl:text>
        var nom = 4; // Number of menus
        var usePictures = 1; // use pictures?  1 = yes, 0 = no
        
        var ttls = new Array(); // An array for the title objects
        var subs = new Array(); // An array for the submenu objects
        var lastn;
        var lastmove;
        
        if (document.layers) {
                visible = 'show';
                hidden = 'hide';
        }
        else
        if (document.all) {
                visible = 'visible';
                hidden = 'hidden';
        }
        <!-- ### fail #### -->
         for (var i = 1; i <= nom; i++) {
                ttls[i] = ('title' + i);
                subs[i] = ('submenu' +i);
        }
..........
</xsl:text>
</xsl:template>
</xsl:stylesheet>

        




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]