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

Re: selecting HTML Options

Subject: Re: selecting HTML Options
From: Daniel Bibbens <dbibbens@xxxxxxxxxx>
Date: Mon, 17 Jan 2005 21:09:53 -0800
html options
Chris_Graham@xxxxxxxxxxx writes:

> There has to be an easier way to select <option> elements inside a 
> <select> element that this:
>
> [...snip...]
>
> Can anyone point me in the right direction? I'd rather avoid calling java 
> directly... :-(
>
> -Chris
>

I don't know if you'd view this as easier, but it might give you an
idea. Note that months.xml has the following form:

<months>
  <month index="1" abbrev="Jan">January</month>
  <month index="2" abbrev="Feb">February</month>
  <month index="3" abbrev="Mar">March</month>
  <month index="4" abbrev="Apr">April</month>
  <month index="5" abbrev="May">May</month>
  <month index="6" abbrev="Jun">June</month>
  <month index="7" abbrev="Jul">July</month>
  <month index="8" abbrev="Aug">August</month>
  <month index="9" abbrev="Sep">September</month>
  <month index="10" abbrev="Oct">October</month>
  <month index="11" abbrev="Nov">November</month>
  <month index="12" abbrev="Dec">December</month>
</months>

And this is the XSL:

<xsl:variable name="months" select="document('months.xml')/months"/>

<select NAME="cc.expires.month" title="select month">
  <xsl:for-each select="$months/month">
    <xsl:element name="option">
      <xsl:attribute name="value">
         <xsl:value-of select="@index"/>
      </xsl:attribute>
      <xsl:if test="$contact/credit-card/expires/month =
                    @index">
        <xsl:attribute name="selected">
          <xsl:text>selected</xsl:text>
        </xsl:attribute>
      </xsl:if>
      <xsl:value-of select="@index"/>
    </xsl:element>
  </xsl:for-each>
</select>

-- 

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.