473,230 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Muenchian Grouping Method for Multiple Levels

I followed the instructions from the all-knowing Ms. Tennison here;

http://www.biglist.com/lists/xsl-lis.../msg00070.html

And it works great for the first two levels. However, when I tried to
apply it to three levels, the third level just doesn't show. I am sure
its something obvious but I just can't spot it. Can anyone see where I
have gone wrong? Thanks in advance.

Sample from XML file;

<qrySubjectiveBuild1>
<FLDivisionA>0</FLDivisionA>
<FLDivisionADescription>Employees</FLDivisionADescription>
<FLDivisionB>00</FLDivisionB>
<FLDivisionBDescription>Salaries</FLDivisionBDescription>
<SubjectiveCode>0000</SubjectiveCode>
<SubjDesc>Teaching Staff- Teachers Scheme</SubjDesc>
<CentrallyControlled>0</CentrallyControlled>
<SCSDNonUse>0</SCSDNonUse>
</qrySubjectiveBuild1>
<qrySubjectiveBuild1>
<FLDivisionA>0</FLDivisionA>
<FLDivisionADescription>Employees</FLDivisionADescription>
<FLDivisionB>00</FLDivisionB>
<FLDivisionBDescription>Salaries</FLDivisionBDescription>
<SubjectiveCode>0001</SubjectiveCode>
<SubjDesc>Tutors</SubjDesc>
<CentrallyControlled>0</CentrallyControlled>
<SCSDNonUse>0</SCSDNonUse>
</qrySubjectiveBuild1>

(goes from 0001 to 9999 essentially)

and the extract from the XSL file (the page displays fine, just without
the third digit level, so I am happy the issue is within this code)

Keys at top of XSL file;

<xsl:key name="first-digit" match="qrySubjectiveBuild1"
use="FLDivisionA"/>
<xsl:key name="second-digit" match="qrySubjectiveBuild1"
use="concat(FLDivisionA,' ',FLDivisionB)"/>
<xsl:key name="third-digit" match="qrySubjectiveBuild1"
use="concat(FLDivisionA,' ',FLDivisionB,' ',SubjectiveCode)"/>

Grouping code;

<ul>
<xsl:for-each
select="//qrySubjectiveBuild1[generate-id(.)=generate-id(key('first-digit',FLDivisionA))]">
<xsl:sort select="FLDivisionA"/>
<li><a name="{FLDivisionADescription}"><xsl:value-of
select="FLDivisionA" /> - <xsl:value-of
select="FLDivisionADescription" /></a></li>
<ul>
<xsl:variable name="level2group" select="key('first-digit',
FLDivisionA)" />
<xsl:for-each
select="$level2group[generate-id()=generate-id(key('second-digit',concat(FLDivisionA,'
',FLDivisionB))[1])]">
<li><xsl:value-of select="FLDivisionB" /> - <xsl:value-of
select="FLDivisionBDescription" /></li>
<ul>
<xsl:variable name="level3group"
select="key('second-digit',FLDivisionB)" />
<xsl:for-each
select="$level3group[generate-id()=generate-id(key('third-digit',concat(FLDivisionA,'
',FLDivisionB,' ',SubjectiveCode))[1])]">
<li><xsl:value-of select="SubjectiveCode" /> - <xsl:value-of
select="SubjDesc" /></li>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>

Aug 10 '05 #1
2 1947
Hi,
Tempore 15:36:39, die Wednesday 10 August 2005 AD, hinc in foro {comp.text.xml} scripsit reclusive monkey <re**************@gmail.com>:
I followed the instructions from the all-knowing Ms. Tennison
And it works great for the first two levels. However, when I tried to
apply it to three levels, the third level just doesn't show. I am sure
its something obvious but I just can't spot it.

<ul>
<xsl:for-each
select="//qrySubjectiveBuild1[generate-id(.)=generate-id(key('first-digit',FLDivisionA))]">
<xsl:sort select="FLDivisionA"/>
<li><a name="{FLDivisionADescription}"><xsl:value-of
select="FLDivisionA" /> - <xsl:value-of
select="FLDivisionADescription" /></a></li>
<ul>
<xsl:variable name="level2group" select="key('first-digit',
FLDivisionA)" />
<xsl:for-each
select="$level2group[generate-id()=generate-id(key('second-digit',concat(FLDivisionA,'
',FLDivisionB))[1])]">
<li><xsl:value-of select="FLDivisionB" /> - <xsl:value-of
select="FLDivisionBDescription" /></li>
<ul>
<xsl:variable name="level3group"
select="key('second-digit',FLDivisionB)" />
At first sight, this line jumps out. I believe it must be more like this:
<xsl:variable name="level3group"
select="key('second-digit',concat(FLDivisionA,' ',FLDivisionB))" />
<xsl:for-each
select="$level3group[generate-id()=generate-id(key('third-digit',concat(FLDivisionA,'
',FLDivisionB,' ',SubjectiveCode))[1])]">
<li><xsl:value-of select="SubjectiveCode" /> - <xsl:value-of
select="SubjDesc" /></li>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>


regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Vincit omnia simplicitas
Keep it simple
Aug 10 '05 #2
Fantastic Joris, I changed the level3group variable to the syntax you
suggested and it now works perfectly. Many thanks to your keen xslt eye!

Aug 10 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rayt | last post by:
Iím relatively new to XSLT and must admit Iím finding it refreshing, but every now and again something comes along which floors me. Maybe itís the old imperative language background that is hard to...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
1
by: lennyw | last post by:
Hi I'm trying to use XSLT to do an xml to xml transformation where the output xml contains summary data on the information in the input xml. I've succesfully done a Muenchian grouping of the...
1
by: aleksander.hansen | last post by:
Hello, I have xml data that I need to group and sort. I have tried grouping it using the Muenchian Method. Probably not solved the best way, but it works. But I can't get the sorting right. ...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.