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

RE: selecting HTML Options

Subject: RE: selecting HTML Options
From: Chris_Graham@xxxxxxxxxxx
Date: Wed, 19 Jan 2005 11:01:21 +1100
html options
Thanks Michael,

This is the finished result, with exactly what I needed:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xalan="http://xml.apache.org/xslt"
    xmlns:exslt="http://exslt.org/common"
    extension-element-prefixes="exslt">
        <xsl:output method="html" />

        <xsl:variable name="months">
                <option value="00"></option>
                <option value="01">JAN</option>
                <option value="02">FEB</option>
                <option value="03">MAR</option>
                <option value="04">APR</option>
                <option value="05">MAY</option>
                <option value="06">JUN</option>
                <option value="07">JUL</option>
                <option value="08">AUG</option>
                <option value="09">SEP</option>
                <option value="10">OCT</option>
                <option value="11">NOV</option>
                <option value="12">DEC</option>
        </xsl:variable>

        <xsl:template name="monthOptions">
                <xsl:param name="name" />
                <xsl:param name="value" />
                <select name="{$name}">
                        <xsl:apply-templates select=
"exslt:node-set($months)/option" mode="o">
                                <xsl:with-param name="value" select=
"$value" />
            </xsl:apply-templates>
                </select>
        </xsl:template>

        <xsl:template match="option" mode="o">
                <xsl:param name="value" />
                <xsl:copy>
                        <xsl:copy-of select="@value" />
                        <xsl:if test="@value=$value">
                                <xsl:attribute name="selected">selected</
xsl:attribute>
                        </xsl:if>
                        <xsl:value-of select="." />
                </xsl:copy>
        </xsl:template>

        <xsl:template match="/">
                <xsl:call-template name="monthOptions">
                        <xsl:with-param name="name">LEAD_SOURCE_01</
xsl:with-param>
                        <xsl:with-param name="value">03</xsl:with-param>
                </xsl:call-template>
        </xsl:template>
</xsl:stylesheet>



***********************************************************************************
This email contains information confidential to AAMI Limited. If you are not the intended recipient, you must not disclose or use the information in it. If you have received this email in error, please notify us immediately by return email, and delete this email and any attached documents.
AAMI Limited is not responsible for any changes made to a document other than those made by AAMI Limited or for the effect of the changes on the document meaning.
***********************************************************************************

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.