Subject: Re: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method? From: "Michael PG" <xrow@xxxxxxx> Date: Wed, 06 Oct 2004 08:37:34 +0000 |
From: "Werner, Wolfgang" <mail@xxxxxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method?
Date: Wed, 06 Oct 2004 09:57:04 +0200
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
xsltproc, XMLSpy's internal processor and msxml 3.0 yield the following result (differing only in whitespace) using the files in your last mail: <Documents> ~ <Document name="sub"/> ~ <Document name="main"> ~ <Article title="1.2" info="main" filter="food"/> ~ <Article title="2.2" info="main" filter="food"/> ~ </Document> </Documents>
So perhaps it's a bug in msxml 4.0, as Michael suggested.
Wolfgang
Michael PG wrote:
| Hi Anton,
|
|
| Here's the XSL stylesheet:
|
| <?xml version="1.0" encoding="UTF-8"?>
|
| <xsl:stylesheet version="1.0"
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
| <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:param>
|
| <xsl:template match="Documents">
|
| <!-- @filter='' will be true if it is there and empty or if it
| is not there at all) -->
| <xsl:apply-templates select="*[@filter='' or @filter=$filter]"/>
|
| <Documents>
| <xsl:for-each select="Document[@filter='' or
| @filter=$filter]/Article[count(.|key('by-info',@info)[@filter='' or
| @filter=$filter][1])=1]">
| <Document name="{@info}">
| <xsl:copy-of
| select="key('by-info',@info)[@filter=$filter]"/>
| </Document>
| </xsl:for-each>
| </Documents>
|
| </xsl:template>
|
| </xsl:stylesheet>
|
|
| The line proposed by David C. gives an exception.
|
| <xsl:for-each select="Document[@filter='' or
| @filter=$filter]/Article[count(.|key('by-info',@info)[@filter='' or
| @filter=$filter][1])=1]">
|
|
| The XML looks like:
|
| <?xml version="1.0" encoding="utf-8"?>
|
| <Documents>
| <Document chapter="1" title="title 1" href="file1.xml" filter="">
| <Article title="1.1" info="sub" filter="drink"/>
| <Article title="1.2" info="main" filter="food"/>
| </Document>
| <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>
| </Documents>
|
|
| Thanx.
|
| -M
|
|
|> From: Anton Triest <anton@xxxxxxxx>
|> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
|> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
|> Subject: Re: [xsl] Re: [xslt transform & grouping] Using the Muenchian
|> Method?
|> Date: Wed, 06 Oct 2004 00:47:56 +0200
|>
|> Michael PG wrote:
|>
|>> After adding the suggested line I got an exception lake it last case.
|>>
|>> select="Document[@filter='' or
|>> @filter=$filter]/Article[count(.|key('by-info',@info)[@filter='' or
|>> @filter=$filter][1])=1]">
|>
|>
|>
|> Hi Michael (I'm jumping in again, was away yesterday)
|>
|> did you define the key in this template? (that caused the exception
|> last time, didn't it)
|> if so, maybe you'll better post the complete stylesheet once more...
|> (+ exception details)
|>
|> Anton
|>
|>
|>
|
| _________________________________________________________________
| On the road to retirement? Check out MSN Life Events for advice on how
| to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
|
|
|
|
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBY6VPqjaicDyx8o8RAny+AJ4lFZyTIZAW9QenrIJvgFMEPAtqJQCdHetL V5eR7aTRjDw/XcDP6T5kdDY= =rLp6 -----END PGP SIGNATURE-----
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: [xslt transform & gro, Werner, Wolfgang | Thread | Re: [xsl] Re: [xslt transform & gro, Werner, Wolfgang |
RE: [xsl] using XML elements as att, Michael Kay | Date | [xsl] Group and compare data, Verakso |
Month |