H
Hvid Hat
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:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput 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
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:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput 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