Altova Mailing List Archives

Re: n level grouping

From: "B. Rubble" <rahkim@-------.--->
Date: 4/24/2005 7:21:00 AM
Thanks for the reply (I was hoping you would reply.)  I like this
solution much better than some of the Meunchian grouping Ive been doing
with keys and 'generate-id().'  Unfortunately, I now have to follow up
with an extremely stupid question.  Whenever I run the solution you
gave in xml spy, I get the following output:

<xsl:stylesheet version=3D"1.0"
xmlns:params=3D"my:params" exclude-result-prefixes=3D"param=ADs">
<xsl:output method=3D"xml" indent=3D"yes" encoding=3D"utf-8"
omit-xml-declaration=3D"yes" />
<xsl:variable name=3D"vList" select=3D"document('')/*/params:=AD*/*" />
<xsl:template match=3D"/DESCRIPTORS">
<xsl:call-template name=3D"RecursiveGrouping">
<xsl:with-param name=3D"list" select=3D"V_PD" />
<xsl:with-param name=3D"grList" select=3D"$vList" />
<xsl:template name=3D"RecursiveGrouping">
<xsl:param name=3D"list" />
<xsl:param name=3D"grList" />
<xsl:when test=3D"$grList">
<xsl:variable name=3D"catName" select=3D"string($grList[1])" />
<xsl:variable name=3D"group-identifier" select=3D"$list[1]/*[name() =3D
$catName]" />
<xsl:variable name=3D"group"
select=3D"$list[*[name()=3D$catNam=ADe]=3D$group-identifier]" />
<xsl:element name=3D"{$catName}">
<xsl:attribute name=3D"value">
<xsl:value-of select=3D"$group-identifier" />
<xsl:call-template name=3D"RecursiveGrouping">
<xsl:with-param name=3D"list" select=3D"$group" />
<xsl:with-param name=3D"grList" select=3D"$grList[position() &gt; 1]" />
<xsl:if test=3D"count($list)&gt;count($grou=ADp)">
<xsl:call-template name=3D"RecursiveGrouping">
<xsl:with-param name=3D"list"
select=3D"$list[not(*[name()=3D$catName]=3D=AD$group-identifier)]" />
<xsl:with-param name=3D"grList" select=3D"$grList" />
<xsl:copy-of select=3D"$list/Descriptor" />

Im obviously missing something simple here but its beyond me.  As you
can see, its essentially the xsl you listed with some &gt; in place of
>=2E  Im assuming Im missing something in the declaration maybe.  What
should I do?

Thanks again for your help!

Dimitre Novatchev wrote:
> Here's the XSLT 1.0 solution for dynamic grouping.
> Dynamic grouping can have unknown number of grouping levels. The list
> names of each level to group is provided as a parameter,
> This code is a slight modification of the code I published last
December at:
> and is based on an initial work of Sergiu Ignat.
> When this transformation:
> <xsl:stylesheet version=3D"1.0"
>  xmlns:xsl=3D""
>  xmlns:params=3D"my:params"
>  exclude-result-prefixes=3D"params"

.=2E. message abbreviated ...

> Hope this helped.
> Cheers,
> Dimitre Novatchev


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.