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: Selecting an option


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:if>
        <xsl:value-of select="."/>
    </option>
</xsl:template>

> 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
> XSLT.

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

Joerg


 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]