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

Re: xsl loop for display in drop-down box

Subject: Re: xsl loop for display in drop-down box
From: Charlie Cox <xmldev@xxxxxxxxx>
Date: Thu, 23 Mar 2000 05:21:12 -0800 (PST)
xsl loop
if you can, change your 'nothing' line to
<FIRST Selected="Y">Nothing</FIRST>
This will elimnate your blank line and still give you
the option to mark the selected entry.

then you can change your <option>...</option> to the
following:

<xsl:for-each select="FIRST">
<xsl:element name="option">
   <xsl:value-of select="."/>
   <xsl:if select="@Selected='Y'">
      <xsl:attribute name="Selected">Y</xsl:attribute>
   </xsl:if>
   <xsl:value-of select="($tmp)"/>
</xsl:element>
</xsl:for-each>

I have noticed the stylus editor version 1.0 does not
correctly pick up the attribute under the if command,
but it does work correctly in Xalan (EA release). I
have not yet tried this with Stylus 2.0,Xalan 1.0 or
any other xsl parsers.

hope this helps
Charlie

--- Seema Ramanathan <sramanathan@xxxxxxxxxxxx> wrote:
> Hi
> 
> I have the following XML tag:
> <TITLE>
> <FIRST>Something</FIRST>
> <FIRST>Everything</FIRST>
> <FIRST Selected="Nothing"></FIRST>
> </TITLE>
> 
> I want my XSL to display a drop down box with the
> first option to be the selected one - that is
> "Nothing" followed by the others (Something and
> Everything).
> 
> Here is the XSL i use:
> <select name="FIRST">
> <xsl:variable name="tmp"><xsl:value-of
> select="FIRST/@SELECTED"/></xsl:variable>
> <xsl:if test="(normalize($tmp)=true())">
> <option><xsl:value-of select="($tmp)"/></option>
> <xsl:for-each select="MODEL">
> <option><xsl:value-of select="."/></option>
> </xsl:for-each>
> </xsl:if>
> </select>
> 
> When i use the above XSL loop I get a drop down with
> "Nothing" displayed followed by "Something",
> "Everything" and another blank option. How do i get
> rid of the blank? I realize its coming from this
> line "
> <FIRST Selected="Nothing"></FIRST>".
> 
> Is there any way i can ignore it?
> 
> Any help??? Please and TIA
> 
> Seema
> 

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


 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.