[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|