[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: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Fri, 03 May 2002 17:26:27 -0600
javascript for loop length
At 12:54 PM 5/3/2002, you wrote:
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.

As Thomas pointed out, you can reverse the test to read
for (intIndex = 1; dependentObjectArray.length > intIndex; intIndex ++)
[JavaScript note: Do you mean to start at 1 or at 0?]
or you can write it the way you're comfortable and enclose the entire thing in a <![CDATA[ ]]> section.


<xsl:template match="principle">
  <![CDATA[
for (intIndex = 1; intIndex < dependentObjectArray.length; intIndex ++)
  {
  if (dependentObjectArray[intIndex].value == intValue)
    dependentObjectArray[intIndex].disabled = true;
  else
    dependentObjectArray[intIndex].disabled = false;
  }  // ends for
  ]]>
</xsl:template>



Greg Faron
Integre Technical Publishing Co.



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.