Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML -XSL - JavaScript Question

Status
Not open for further replies.

acsooley

Programmer
Nov 13, 2002
32
CA
I have my xsl set up to read my xml docs to produce the page. The proble is that their are many different people in each xml doc. I want to place these ppl in a table with 5 columns and break after 5 and start a new row. I cant seem to get this to work it will just display all ppl in one row. Does anyone know of a way to create a counter or something in JS to break after 5 ppl and create a new row?

Thanks
Adam
 
Another similar option with XSL using Mod (&quot;Mod # = 1&quot; where # is the column count). Here I am writing out the &quot;</tr><tr>&quot; and closing &quot;</tr>&quot; tags to avoid XSL errors.

<table>
<xsl:apply-templates select=&quot;PeopleList&quot; mode=&quot;whatever&quot;/>
</table>

<xsl:template match=&quot;People&quot; mode=&quot;whatever&quot;>
<xsl:choose>
<xsl:when test=&quot;position() mod 5 = 1&quot;>
<xsl:text disable-output-escaping=&quot;yes&quot;>&amp;lt/tr&ampgt;&amplt;tr&amp;gt;</xsl:text>
</xsl:when>
<xsl:eek:therwise></xsl:eek:therwise>
</xsl:choose>

<td><xsl:value-of select=&quot;Person&quot;/></td>

<xsl:choose>
<xsl:when test=&quot;position() = last&quot;>
<xsl:text disable-output-escaping=&quot;yes&quot;>&quot;>&amp;lt/tr&ampgt;</xsl:text>
</xsl:when>
<xsl:eek:therwise></xsl:eek:therwise>
</xsl:choose>


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top