This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: xsl loop for display in drop-down box


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@dreamlot.com> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]