Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • dalton 14 posts 34 karma points
    Jun 10, 2011 @ 17:10
    dalton
    0

    start a new table after ten columns?

    Hey im trying to generate a table but it has too many columns to print on one page so I would like to break the table after 10 columns of players this is my xsl now.

    <xsl:template name="stats">
        <table cellspacing="0" cellpadding="0" class="info">
            <xsl:for-each select="/report/home/game">
                <xsl:call-template name="structure"/>
            </xsl:for-each>
        </table>
    </xsl:template>
    
    <xsl:template name="structure">
        <tr>
            <td class="border">Opponent</td>
            <td class="center border">Date</td>
            <td class="center border">Score</td>
            <td class="border">&#160;</td>
            <xsl:for-each select="player">
            <td class="center border"><xsl:value-of select="lastName"/><xsl:value-of select="firstName"/></td>
            <xsl:if test="position() mod 10 = 0 and position() != last()">
                <xsl:text disable-output-escaping="yes">
                     &lt;/tr&gt;&lt;tr&gt;
                  </xsl:text> 
            </xsl:if>
            </xsl:for-each>
        </tr>
        <tr>
            <td class="border">something</td>
            <td class="center border">something</td>
            <td class="center border">something</td>
            <td class="border">&something</td>
            <xsl:for-each select="player">
            <td class="center border"><xsl:value-of select="something"/></td>
            <xsl:if test="position() mod 10 = 0 and position() != last()">
                <xsl:text disable-output-escaping="yes">
                     &lt;/tr&gt;&lt;tr&gt;
                  </xsl:text> 
            </xsl:if>
            </xsl:for-each>
        </tr>
    </xsl:template>
    I want the output to look like this
    <table>
        <tr>
            <td>Opponent</td>
            <td>date</td>
            <td>score</td>
            <td>&#160;</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
        </tr>
        <tr>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
        </tr>
    </table>
    <!-- i want it to do this for every 10 players-->
    <table>
        <tr>
            <td>Opponent</td>
            <td>date</td>
            <td>score</td>
            <td>&#160;</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
            <td>player</td>
        </tr>
        <tr>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
            <td>something</td>
        </tr>
    </table>
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 10, 2011 @ 17:39
Please Sign in or register to post replies

Write your reply to:

Draft