Subject: RE: [xsl] selecting HTML Options From: Chris_Graham@xxxxxxxxxxx Date: Wed, 19 Jan 2005 11:01:21 +1100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] selecting HTML Options, Chris_Graham | Thread | [xsl] Xalan XSLT transformation usi, Ivan . Price |
RE: [xsl] selecting HTML Options, Chris_Graham | Date | RE: [xsl] how to call extension fun, Michael Kay |
Month |