Subject: Re: [xsl] javascript for loop inside xsl template From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx> Date: Fri, 3 May 2002 15:57:43 -0400 |
[Ken Schulte] > I was wondering if anybody could tell how to write a > javascript for loop inside an xsl template. > > > <xsl:template match="principle"> > for (intIndex = 1; intIndex < dependentObjectArray.length; > intIndex++) > { > if ( dependentObjectArray[intIndex].value == intValue ) > { > dependentObjectArray[intIndex].disabled = true; > } > else > { > dependentObjectArray[intIndex].disabled = false; > } > } > </xsl:template> > > It's blowing up on < in the for loop condition. > It all depends on what you mean. It looks like you want to output some javascript that will be included in an html file that will later run on a browser (or possibly a server). Is that right? Otherwise, if you expect to have the javascript actually execute while the stylesheet is being processed, that won't happen. If this is what you really want, there have been some recent threads on it and you can search the list archives for them. Assuming you want the first possibility, what you wrote might work, although it does not insert any data from your xml file into the javascript loop. You should write the javascript you want and get it working, then compare it to what the stylesheet is producing. BTW, you can avoid writing "<" by simply reversing the sense of the comparison and using ">" instead. If after this you still want help, at least you could say how you are trying to run it and what error message you are getting. But first get clear on what you want to produce and what is different about the stylesheet output. Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] javascript for loop inside xs, Ken Schulte | Thread | Re: [xsl] javascript for loop insid, Greg Faron |
[xsl] Mulberry Quickref, Wendell Piez | Date | Re: [xsl] passing intermediate resu, Jeni Tennison |
Month |