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

Subject: Re: [xsl] Re: [xslt transform & grouping] Using the Muenchian Method?
From: "Werner, Wolfgang" <mail@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 06 Oct 2004 10:58:46 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Posting the exact exception message and the version of your processor
would have been much more helpful.

Wolfgang


Michael PG wrote:


| I don't think that's there'a an bug in msxml.
|
| -M
|
|
|> 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
|>
| 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
| |
| |
| |
| |
|
|>
|>

| _________________________________________________________________
| FREE pop-up blocking with the new MSN Toolbar ? get it now!
| http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBY7PFqjaicDyx8o8RAtaSAKCK15QCOCxiwKIZgJ+z9JQqRPVNrACfXu1n
6FzRHNJrHdmbQ7t5ZCKDrX0=
=uWRD
-----END PGP SIGNATURE-----

Current Thread