-
Nesting <xsl:for-each> statements?
Is it illegal to have nested <xsl:for-each> statements? I'm trying to populate
the contents of a drop-down box inside a table using the code below. The
"outer" for-each statement works fine. It is just inserting data into the
table one row at a time. However, what I need the "inner" for-each statement
to do is to grab the elements from another data island on my page, and insert
them into the drop down box. This needs to be repeated for each iteration
of the "outer" for-each loop. I'm about to stop the insanity and build this
table out using the DOM. Any ideas??
Thanks!
<xsl:for-each select="RootNode/Records/row">
<tr>
<td class="label"><xsl:value-of select="@Description"/></td>
<td class="label"><input id="txtLimit{@SubCoverageID}" type="text" maxlength="7"
size="7" value="{@Limit}"/></td>
<td class="label">
<select id="selDeductible{@SubCoverageID}">
<xsl:for-each select="RootNode/Deductible/MenuItem">
<option><xsl:value-of select="Item"/></option>
</xsl:for-each>
</select>
</td>
<td class="label"><span id="spnPremium{@Premium}"></span></td>
</tr>
</xsl:for-each>
-
Re: Nesting <xsl:for-each> statements?
I've done some similar stuff before, and got it to work when the inner loop
referred to the nodes with ".." (ex. ../row). I think you just have to think
carefully about which node each iteration is pointing to in the outer loop
and compose the inner loop accordingly.
good luck,
"rj" <rpjolly@yahoo.com> wrote:
>
>Is it illegal to have nested <xsl:for-each> statements? I'm trying to populate
>the contents of a drop-down box inside a table using the code below. The
>"outer" for-each statement works fine. It is just inserting data into the
>table one row at a time. However, what I need the "inner" for-each statement
>to do is to grab the elements from another data island on my page, and insert
>them into the drop down box. This needs to be repeated for each iteration
>of the "outer" for-each loop. I'm about to stop the insanity and build
this
>table out using the DOM. Any ideas??
>Thanks!
>
><xsl:for-each select="RootNode/Records/row">
> <tr>
> <td class="label"><xsl:value-of select="@Description"/></td>
> <td class="label"><input id="txtLimit{@SubCoverageID}" type="text" maxlength="7"
>size="7" value="{@Limit}"/></td>
> <td class="label">
> <select id="selDeductible{@SubCoverageID}">
> <xsl:for-each select="RootNode/Deductible/MenuItem">
> <option><xsl:value-of select="Item"/></option>
> </xsl:for-each>
> </select>
> </td>
> <td class="label"><span id="spnPremium{@Premium}"></span></td>
> </tr>
></xsl:for-each>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks