Greetings
I'm looking for a better more generalized way to handle html drop down
listboxes. Currently I'm writing code much like below, where I create a
seperate template for each drop down, altering the XPath to the xml
list of label/values ("Status"), name of the select control (status_id),
and initial value for the control ("/Page/Data/Edit/status_id").
The xsl looks like this:
<xsl:apply-templates select="Status" />
...
<xsl:template match="Status">
<select name="status_id">
<option value=""></option>
<xsl:for-each select="Option">
<option>
<xsl:if test="value = /Page/Data/Edit/status_id">
<xsl:attribute name="selected">1</xsl:attribute>
</xsl:if>
<xsl:attribute name="value">
<xsl:value-of select="value" />
</xsl:attribute>
<xsl:value-of select="label" />
</option>
</xsl:for-each>
</select>
</xsl:template>
xml:
<Status>
<Option>
<label>Pretest</label><value>4</value>
</Option>
<Option>
<label>Test</label><value>3</value>
</Option>
</Status>
I'm hoping there is a way to write a single template where I can call it
several places and somehow pass different values for those three
variables each time. Any suggestions?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mattison Narramore peacock(_at_)panix(_dot_)com +
+-----------------------------------------------------------------+
+ The most likely way for the world to be destroyed, most experts +
+ agree, is by accident. That's where we come in; we're computer +
+ professionals. We cause accidents. +
+ -Nathaniel Borenstein +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list