Re: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method?

Subject: Re: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method?
From: "Michael PG" <xrow@xxxxxxx>
Date: Thu, 07 Oct 2004 11:29:42 +0000

Now when everything else is working, and when I found the workaround to use Muenchian method in MSXML, I have one more issue.

Currently, when grouping is performed, (see the structure of the XML below), if there is no attribute filter defined in Article element (see info=child in the third Document parent node), or if there is no value in the Article element, the group "child" will not be generated, instead the Article element will hang outside it's own group or directly in the root.

I would like not to display all other elements (like the one in the XML examle below) that doesn't contain any value in the filter element, att all in the tree root.



In the following XSLT (current state)

<?xml version='1.0' encoding='UTF-8'?>

<xsl:stylesheet version="1.0" xmlns:xsl="";>

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:key name="by-info" match="Article" use="@info"/>

<xsl:param name="filter" select="'food'"/>

<xsl:template match="Documents">
<xsl:for-each select="Document[@filter='' or @filter=$filter]/Article[generate-id()=generate-id(key('by-info',@info)[@filter='' or @filter=$filter])]">
<Document name="{@info}">
<xsl:copy-of select="key('by-info',@info)[@filter=$filter]"/>



<?xml version="1.0" encoding="utf-8"?>

	<Document chapter="1" title="title 1" href="file1.xml" filter="food">
		<Article title="1.1" info="sub" filter="food"/>
		<Article title="1.2" info="main" filter="food"/>
	<Document chapter="2" title="title 2" href="file2.xml" filter="drink">
		<Article title="2.1" info="sub" filter="drink"/>
		<Article title="2.2" info="main" filter="food"/>
	<Document chapter="3" title="title 3" href="file2.xml" filter="">
		<Article title="3.1" info="sub" filter="drink"/>
		<Article title="3.2" info="child" filter=""/>

From: David Carlisle <davidc@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method?
Date: Wed, 6 Oct 2004 13:44:00 +0100

> I tried to use other namespace in XSLT file.
> <xsl:stylesheet xmlns:xsl=""/>

that's not just another namespace that is a different language that is
almost completely unrelated to XSLT. It was implemented in msxml 2 (and so
IE5) prior to Microsoft implementing XSLT, MSXML3 implemented both
languages, MSXML4 and later products only implement XSLT. No
non-microsft product ever implemented that language, which was loosely
based on an early draft of XSL but mainly consisted of microsoft specific

Microsoft's wd-xsl doesn't have anything analogous to xsl:key as far as
I can recall and the behaviour of its templating language was quite
different. So you'd have to completely re-write your stylesheet to use
that language.

It would be bizarre indeed to use that language when it is not supported
in any current product. I don't know but I would be most surprised if it
is implemented in the standard .net classes.


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Express yourself instantly with MSN Messenger! Download today - it's FREE! ht

Current Thread