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

Re: <xsl:when> Problems (with IE5)

Subject: Re: <xsl:when> Problems (with IE5)
From: "Nikita Ogievetsky" <nogievet@xxxxxxxxxxxx>
Date: Tue, 26 Oct 1999 00:41:03 +0100
xsl attribute selected
Oliver,
what you are writing should not work in any parser:
select is an attribute with a single value.
This means that both <option selected="true"/> and <option
selected="false"/> will make option selected.
Parsers conformant with the latest WD will change <option
selected="selected"/> into <option selected/>
One way to solve your problem is the following:

          <select>
            <option value="VALUE1">
                <xsl:choose>
                  <xsl:when test=".='VALUE1'"><xsl:attribute
name="selected">selected</xsl:attribute></xsl:when>
                </xsl:choose>
              THE VALUE 1
            </option>
            <option value="VALUE2">
                <xsl:choose>
                  <xsl:when test=".='VALUE2'"><xsl:attribute
name="selected">selected</xsl:attribute></xsl:when>
                </xsl:choose>
              THE VALUE 2
            </option>
           </select>

Nikita Ogievetsky
http://www.cogx.com

----- Original Message -----
From: <oberthier@xxxxxxxxxxxx>
To: <XSL-List@xxxxxxxxxxxxxxxx>
Sent: Monday, October 25, 1999 5:15 PM
Subject: <xsl:when> Problems (with IE5)


>
> For the creation of a prototype transforming XML into XSL on the
> client, I'm currently trying the following:
>
>   - I'm having an XML document containing an element with a
>     value inside.
>     E.g. <item1>VALUE1</item1>
>
>   - I would like to produce an HTML output containing a
>     selection list with the text of the item1 currently
>     selected by default in the list.
>     E.g. <select>
>            <option value="VALUE1" selected>THE VALUE 1</option>
>            <option value="VALUE2">THE VALUE 2</option>
>          </select>
>
>   - In a template for the element item1, I'm using for this
>     purpose the following XSL fragment:
>          <select>
>            <option value="VALUE1">
>              <xsl:attribute name="selected">
>                <xsl:choose>
>                  <xsl:when test=".='VALUE1'">true</xsl:when>
>                  <xsl:otherwise>false</xsl:otherwise>
>                </xsl:choose>
>              </xsl:attribute>
>              THE VALUE 1
>            </option>
>            <option value="VALUE2">
>              <xsl:attribute name="selected">
>                <xsl:choose>
>                  <xsl:when test=".='VALUE2'">true</xsl:when>
>                  <xsl:otherwise>false</xsl:otherwise>
>                </xsl:choose>
>              </xsl:attribute>
>              THE VALUE 2
>            </option>
>           </select>
>
> The result seems fine under some of the XSL parsers I've used,
> however I don't manage to make the test attribute work as
> expected with IE5, which is the browser in which I'm intending
> to build the prototype mentioned.
>
> Any help on making the test attribute above check the content
> of the current element against a given string in such a simple
> and standard way that I would have the same result with IE5
> and the parsers following the latest recommandation?
>
> Thanks in advance,
>
> Olivier.
>



 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.