|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML grouping by attribute using Muenchian method?
dont make this harder than it is..
<xsl:variable name="someName" select="book/@type = 'myshelf'"/>
Best of luck...
M.
----- Original Message -----
From: "Kaarle Kaila" <kaarle.kaila@xxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, November 26, 2003 3:17 AM
Subject: Re: XML grouping by attribute using Muenchian method?
> hi,
>
> As I have just recently struggled with the similar task I give you my
> version of xslt thatr does about that here:
> ----------------------------------------------
> <xsl:stylesheet version = '1.0'
> xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
> >
> <xsl:key name="contacts-by-shelf" match="//book" use="@type" />
> <xsl:template match="bookshelf">
>
> <html>
> <head>
> <title>Shelfs</title>
> </head>
> <body>
> <h1>Index (fi)</h1>
> <table border="1">
> <tr><td align="left">Shelf</td><td align="left">Book</td></tr>
>
> <xsl:for-each select="//book[count(. | key('contacts-by-shelf',
@type)[1])
> = 1]">
> <xsl:sort select="@type" lang="fi"/>
>
>
> <tr><td align="left" valign="top"><xsl:apply-templates select="@type"/>
> </td><td>
> <xsl:for-each select="key('contacts-by-shelf',@type)">
> <xsl:value-of select="@title" /><br/>
>
> </xsl:for-each>
> </td></tr>
> </xsl:for-each>
>
> </table>
> </body>
> </html>
>
> </xsl:template>
>
> </xsl:stylesheet>
> --------------------------------------
>
> regards
> Kaarle Kaila
> --
> Kaarle Kaila
> email: kaarle dot kaila at iki dot fi
> www.iki.fi/kaila
>
> ----- Original Message -----
> From: <nicolas.m@xxxxxxxxxxx>
> To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, November 26, 2003 11:10 AM
> Subject: XML grouping by attribute using Muenchian method?
>
>
> > Hi
> >
> > This is my XML
> >
> > <bookshelf>
> > <book type="myshelf" title="some book" />
> > <book type="yourshelf" title="some other book" />
> > <book type="myshelf" title="yet some other book" />
> > </bookshelf>
> >
> > I want to group these books by attribute "type" e.g. looking like this
> >
> > myshelf
> > some book
> > yet some other book
> > yourshelf
> > some other book
> >
> > I've been messing around with keys but I can't get the desired result...
> >
> > Thanks
> > Nicolas
> >
> >
> > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








