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

FW: For Loop in XSL

Subject: FW: For Loop in XSL
From: Ben Robb <Ben@xxxxxxxxxx>
Date: Mon, 13 Dec 1999 09:43:54 -0000
xsl for loop
Lets try that again, shall we (without pressing Ctrl-Enter halfway through
writing it *grin*)



I wouldn't use anything like "END_INDEX" in my XML. Try something like this:


--- XML ---

<item>1</item>
<item>2</item>
<item>3</item>
.....
<item>10</item>


--- XSL ---

<select name="number">
<xsl:for-each select="item">
	<option value="{text()}"><xsl:value-of /></option>
</xsl:for-each>
</select>


That is probably the most elegant way - you never need to actually know how
many options you have, so you can extend it by only changing the XML in one
place.

Rgs,

Ben


-----Original Message-----
From: Low Kiam Imm [mailto:juneFaye@xxxxxxxxxxxxxx]
Sent: 13 December 1999 07:30
To: XSL-List@xxxxxxxxxxxxxxxx
Subject: For Loop in XSL


Greetings,
    hi, I'm new in XSL. I need to generate a drop down
box in the HTML. I got the END_INDEX from the XML file
and the default start index is always 1 and increment
is +1.

   My question is: how am I going to populate the drop
down box value in my XSL ? Can it be done? (i.e. using
maybe a for loop). I know there is a <xsl:for-each>
but is it suitable to use in this case?

   Part of My XML file:
    <END_INDEX>10</END_INDEX>

   My XSL File:
    <SELECT NAME="NUMBER">
     ??...
    </SELECT>

   Ideal Output:
    <SELECT NAME="NUMBER">
    <OPTION VALUE="1">1</OPTION>
    <OPTION VALUE="2">2</OPTION>
    <OPTION VALUE="3">3</OPTION>
    <OPTION VALUE="4">4</OPTION>
    <OPTION VALUE="5">5</OPTION>
    <OPTION VALUE="6">6</OPTION>
    <OPTION VALUE="7">7</OPTION>
    <OPTION VALUE="8">8</OPTION>
    <OPTION VALUE="9">9</OPTION>
    <OPTION VALUE="10">10</OPTION>
    </SELECT>

    Any suggestion? TIA!

===
Regards,
June   


__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 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.