troubleshooting Question

XSLT for-each conditional table rows

Avatar of jsm11482
jsm11482 asked on
3 Comments1 Solution484 ViewsLast Modified:
Bad title, I know.  I have a XML file part of which contains a bunch of "Nutrient" elements. I want to display these in a table, 2 nutrients per row. My current XSL is:

            <xsl:for-each select="Nutrient[@Type=2]">
                  <xsl:if test="position() mod 2 != 0">
                  <td colspan="2" style="font-size: 10pt; font-family: Arial; background-color: #deebde; border-bottom: solid 1px #000000;">
                        <xsl:value-of select="@Name"/> <xsl:value-of select="@Amount"/>
                  <xsl:if test="position() mod 2 = 0 or position() = last()">

I put the <tr> and </tr> in CDATA because otherwise it would be angry that I didnt have a closing </tr>. This does not work of course and is also not correct, what is?

Gertone (Geert Bormans)
Information Architect
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros