Re: [xsl] Selecting an option

Subject: Re: [xsl] Selecting an option
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 12 Sep 2001 21:57:40 +0200
Hi Carlos and Heather,

I only want to point out, that the stylesheet can be shortened in the
following part:

> <xsl:template match="value">
>   <xsl:param name="default"/>
>   <xsl:choose>
>     <xsl:when test=". = $default">
>       <option value="{.}" selected="selected">
>         <xsl:value-of select="."/>
>       </option>
>     </xsl:when>
>     <xsl:otherwise>
>       <option value="{.}">
>         <xsl:value-of select="."/>
>       </option>
>     </xsl:otherwise>
>   </xsl:choose>
> </xsl:template>

<xsl:template match="value">
    <xsl:param name="default"/>
    <option value="{.}">
        <xsl:if test=".=$default">
            <xsl:attribute name="selected">selected</xsl:attribute>
        <xsl:value-of select="."/>

> I hope that helps.  It's hard to know what you are asking for without
> example XML and the relevant segment of what you've tried so far in your

That was my problem too: What do you want exactly?


 XSL-List info and archive:

Current Thread