[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Javascript looping expression in stylesheet

Subject: Javascript looping expression in stylesheet
From: "Zoe Peng" <zoe@xxxxxxxxxxxx>
Date: Wed, 8 May 2002 14:22:23 -0400
javascript looping
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.