How to split a grouping into 3 parts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hvid Hat

    #1

    How to split a grouping into 3 parts

    Hi

    At first, I thought I could only solve my problem with a C# method inside
    my XSLT but I'm beginning to think it might be possible with XSLT only. So
    I'm trying, but I need help :-) How can I split a grouping into 3 parts?

    I've got the following grouping of countries which is working fine:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:styleshe et version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:key name="x" match="Country" use="." />
    <xsl:template match="Persons" >
    <xsl:for-each select="Person[generate-id(Country) = generate-id(key('x',
    Country)[1])]">
    <xsl:value-of select="Country " /><br />
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    But how can I split the grouping into 3 parts. Say there's 11 (unique) countries.
    How can I split them into 3 parts so I can produce 3 lists of 4, 4 and 3
    elements, e.g.

    <ul>
    <li>Argentina </li>
    <li>Belgium</li>
    <li>Canada</li>
    <li>Denmark</li>
    </ul>
    <ul>
    <li>England</li>
    <li>France</li>
    <li>Greece</li>
    <li>Hungary</li>
    </ul>
    <ul>
    <li>Iceland</li>
    <li>Japan</li>
    <li>Kenya</li>
    </ul>


Working...