EDN Admin
Well-known member
Hello
I have a table based dropdown on a page
I receive XML as
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; CompanyNameList<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupType<span style="color:Blue; >Symbol<span style="color:Blue; </<span style="color:#A31515; LookupType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupValue<span style="color:Blue; >SYM<span style="color:Blue; </<span style="color:#A31515; LookupValue<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupType<span style="color:Blue; >GENE<span style="color:Blue; </<span style="color:#A31515; LookupType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupValue<span style="color:Blue; >GEN<span style="color:Blue; </<span style="color:#A31515; LookupValue<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; CompanyNameList<span style="color:Blue; >
[/code]
and I use something like this
<pre><tr><td>
<select name="CompanyName" id="CompanyName
<option value="0 -Select-</option>
<xsl:for-each select="//ComapnyNameList/ComapnyName
<option>
<xsl:attribute name="value <xsl:value-of select="./LookupType"/></xsl:attribute>
<xsl:value-of select="./LookupValue"/>
</option>
</xsl:for-each>
</select>
</td></tr>[/code]
Now, my requirement is I need to have this drop down on a page 10 times, and I am trying to use a xslt loop for this.
<pre><xsl:template name="for.loop
<xslaram name="i" />
<xslaram name="count" />
<!--begin_: Line_by_Line_Output -->
<xsl:if test="$i <= $count
<!-- This $i variable gives the increment value -->
<xsl:value-of select="$i"/>
</xsl:if>
<!--begin_: RepeatTheLoopUntilFinished-->
<xsl:if test="$i <= $count
<xsl:call-template name="for.loop
<xsl:with-param name="i
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="count
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template> [/code]
and I use the below to acheive this
<pre><xsl:call-template name="for.loop
<xsl:with-param name="i 1</xsl:with-param>
<xsl:with-param name="count 10</xsl:with-param>
<tr><td>
<select name="CompanyName" id="CompanyName
<option value="0 -Select-</option>
<xsl:for-each select="//ComapnyNameList/ComapnyName
<option>
<xsl:attribute name="value <xsl:value-of select="./LookupType"/></xsl:attribute>
<xsl:value-of select="./LookupValue"/>
</option>
</xsl:for-each>
</select>
</td></tr>
</xsl:call-template>[/code]
But it looks like that <tr> tag can not be inside <xsl:call-template>
because the editor gives me an error "Unexpected element <tr>"
Can you tell me how should I use a loop to print this drop down 10 times, in 10 different rows (<tr>)
Thank you
View the full article
I have a table based dropdown on a page
I receive XML as
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; CompanyNameList<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupType<span style="color:Blue; >Symbol<span style="color:Blue; </<span style="color:#A31515; LookupType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupValue<span style="color:Blue; >SYM<span style="color:Blue; </<span style="color:#A31515; LookupValue<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupType<span style="color:Blue; >GENE<span style="color:Blue; </<span style="color:#A31515; LookupType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; LookupValue<span style="color:Blue; >GEN<span style="color:Blue; </<span style="color:#A31515; LookupValue<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; CompanyName<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; CompanyNameList<span style="color:Blue; >
[/code]
and I use something like this
<pre><tr><td>
<select name="CompanyName" id="CompanyName
<option value="0 -Select-</option>
<xsl:for-each select="//ComapnyNameList/ComapnyName
<option>
<xsl:attribute name="value <xsl:value-of select="./LookupType"/></xsl:attribute>
<xsl:value-of select="./LookupValue"/>
</option>
</xsl:for-each>
</select>
</td></tr>[/code]
Now, my requirement is I need to have this drop down on a page 10 times, and I am trying to use a xslt loop for this.
<pre><xsl:template name="for.loop
<xslaram name="i" />
<xslaram name="count" />
<!--begin_: Line_by_Line_Output -->
<xsl:if test="$i <= $count
<!-- This $i variable gives the increment value -->
<xsl:value-of select="$i"/>
</xsl:if>
<!--begin_: RepeatTheLoopUntilFinished-->
<xsl:if test="$i <= $count
<xsl:call-template name="for.loop
<xsl:with-param name="i
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="count
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template> [/code]
and I use the below to acheive this
<pre><xsl:call-template name="for.loop
<xsl:with-param name="i 1</xsl:with-param>
<xsl:with-param name="count 10</xsl:with-param>
<tr><td>
<select name="CompanyName" id="CompanyName
<option value="0 -Select-</option>
<xsl:for-each select="//ComapnyNameList/ComapnyName
<option>
<xsl:attribute name="value <xsl:value-of select="./LookupType"/></xsl:attribute>
<xsl:value-of select="./LookupValue"/>
</option>
</xsl:for-each>
</select>
</td></tr>
</xsl:call-template>[/code]
But it looks like that <tr> tag can not be inside <xsl:call-template>
because the editor gives me an error "Unexpected element <tr>"
Can you tell me how should I use a loop to print this drop down 10 times, in 10 different rows (<tr>)
Thank you
View the full article