473,226 Members | 1,681 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,226 software developers and data experts.

Muenchian problem


I'm trying to apply Muenchian grouping to the XML displayed below but
having no success, I'm trying to group on the section element, any
pointers would be much appreciated:



---- XML ----
<?xml version="1.0" encoding="utf-8"?>
<pagename>The Band</pagename>
<menuname>The Band</menuname>
<container name="content">
<element type="BandMember">
<name>Luke Skywalker</name>
<section>Front Row Cornets</section>
<musicpiece>Lazy Trumpeter</musicpiece>
<element type="BandMember">
<name>Joe Bloggs</name>
<element type="BandMember">
<name>Some Body</name>
<section>Front Row Cornets</section>
<notes>Some notes</notes>

--- XSLT ----

<xsl:key name="section-group" match="element"

<xsl:template match="/" mode="show">
<xsl:for-each select="element[generate-id() =
generate-id(key('section-group',section) [1])]">
<xsl:value-of select="section"/>
<xsl:for-each select="key('section-group',section)">
<xsl:value-of select="name"/>


May 10 '06 #1
1 1294
You should use the section in the key as that is what you want to group
on. Then the for-each selecting element in the document context (/)
will not select anything. Last, you need either to remove the mode on
the template or have some other template that applies templates with
the show mode on the document node. A working stylesheet is below:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:key name="section-group" match="element" use="section"/>

<xsl:template match="/">
<xsl:for-each select="//element[generate-id() =
generate-id(key('section-group',section) [1])]">
<xsl:value-of select="section"/>
<xsl:for-each select="key('section-group',section)">
<xsl:value-of select="name"/>

George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

May 10 '06 #2

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

Similar topics

by: Tristan Miller | last post by:
Greetings. I have a question involving sorting and grouping output using XSLT. I am trying to produce a publication list from a BibTeX-like XML file: <bibxml:file...
by: Peter Olcott | last post by:
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...
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
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...
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. ...
by: la.brunning | last post by:
Hello, I am trying to filter a Muenchian grouping I have created. I think I am fairly close, but I am not quite sure where to apply my filter; its been some time since I did any work with XSLT....
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
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...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
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...
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...
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...

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.