[XSL-LIST Mailing List Archive Home]
[Reply To This Message]
Re: Re: [xslt transform & grouping] Using the Muenchia
Subject: Re: Re: [xslt transform & grouping] Using the Muenchian Method?|
From: Anton Triest <anton@xxxxxxxx>
Date: Thu, 07 Oct 2004 15:09:58 +0200
Michael PG wrote:
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 XPath, you can add a predicate to the Document element:
That would leave out the Document elements with no Article passing the
But I noticed something else... the Document[@filter='' or
@filter=$filter] predicate seems to have no effect.
This has been a somewhat chaotic thread, and I'm not sure why it was
introduced, in any case
if you remove that predicate, the output stays the same. If it was meant
to completely filter out Document
elements with a different filter then it doesn't work: Article "2.2" is
in the output although its parent has
a filter="drink". (I think it has no effect on the output because a key
selects elements in the whole file).
If on the other hand it was meant to allow passing an empty string in
the param (for not applying any filter)
then you need [$filter='' or @filter=$filter] instead of [@filter='' or
If you can't get it to work then it might be a good idea to start this
all over again, and give us once more
a detailed description of what you want, for all possible combinations
of filters, with a sample input and
above all, the desired output.
In the following XSLT (current state)
<?xml version='1.0' encoding='UTF-8'?>
<xsl:output method="xml" version="1.0" encoding="UTF-8"
<xsl:key name="by-info" match="Article" use="@info"/>
<xsl:param name="filter" select="'food'"/>
<xsl:for-each select="Document[@filter='' or
<?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"
<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>
Subject: Re: Re: [xslt transform & grouping] Using the
Date: Wed, 6 Oct 2004 13:44:00 +0100
> I tried to use other namespace in XSLT file.
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-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
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
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
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format