xslt problem help!

  • Thread starter timothy ma and constance lee
  • Start date
T

timothy ma and constance lee

Sir

I am using the recursive template to generate the dynamic drop down list as
below:

<xsl:template name="generateDropdown">
<xsl:param name="length" />
<xsl:param name="refrid" />
<xsl:param name="count" select="$length"/>

<xsl:if test="$length > 0">
<option value="{$refrid}|{$count - $length +1}"><xsl:value-of
select="$count -
$length +1" /></option>
<xsl:call-template name="generateDropdown">
<xsl:with-param name="length" select="$length -1"/>
<xsl:with-param name="count" select="$count"/>
<xsl:with-param name="refrid" select="$refrid"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

The value will be ascending order from 1 to length. However, is it possible
to add the blank line like option value
<option value=""></option> so that the toppest list is blank value first and
then 1 and so on
 
J

Joris Gillis

However, is it possible
to add the blank line like option value
<option value=""></option> so that the toppest list is blank value first and
then 1 and so on

Hi,

just add
<xsl:template name="generateDropdown">
<xsl:param name="length" />
<xsl:param name="refrid" />
<xsl:param name="count" select="$length"/>

<xsl:if test="$length &gt; 0">
<option value="{$refrid}|{$count - $length +1}"><xsl:value-of
select="$count -
$length +1" /></option>
<xsl:call-template name="generateDropdown">
<xsl:with-param name="length" select="$length -1"/>
<xsl:with-param name="count" select="$count"/>
<xsl:with-param name="refrid" select="$refrid"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,100
Latest member
MelodeeFaj
Top