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

Re: javascript for loop inside xsl template

Subject: Re: javascript for loop inside xsl template
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Fri, 3 May 2002 15:57:43 -0400
javascript for loop
[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 &lt; dependentObjectArray.length;
> intIndex++)
> {
>   if (  dependentObjectArray[intIndex].value  ==  intValue )
>   {
>      dependentObjectArray[intIndex].disabled = true;
>   }
>   else
>   {
>      dependentObjectArray[intIndex].disabled = false;
>   }
> }
> </xsl:template>
>
> It's blowing up on &lt; 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 "&lt;" 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

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.