This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Unique headers
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Unique headers
- From: "Kanthi Damodaran" <kanthi_damodaran at hotmail dot com>
- Date: Thu, 05 Apr 2001 12:31:12
- Reply-To: xsl-list at lists dot mulberrytech dot com
Thanks for the update but I did not want the grouping order to be changed
.... meaning that I did not want the 'General' type to be cateogrized. Only
those that are specific types like mystery, horror etc ... This is wherein
lies my problem. I apologize for not having clarified it better. Any
thought on this?
Kanthi
>From: Dan Diebolt <dandiebolt@yahoo.com>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: xsl-list@lists.mulberrytech.com
>CC: kanthi_damodaran@hotmail.com
>Subject: Re: [xsl] Unique headers
>Date: Wed, 4 Apr 2001 21:21:20 -0700 (PDT)
>
>Your desired output appears to treat General movies special in
>that they are not categorized or indented:
>
> > Chocolat
> > Billy
> > Mystery
> > Ellen Brokovich
> > Pelican Brief
> > Horror
> > Nightmare on Elm Street
> > Blair Witch Project
> > The Emperor's Groove
> > Toy Story
>
>I ignored this and additionally changed your MoviesList tag to
>MovieList (double plural). This is a grouping problem solved
>by the so called "Muenchian Method" (named after Steve Muench
>who proposed it). You can serach the archives for a full
>explanation of the technique. The output is simple text
>with <br/> elements; you can html-ify it to your liking:
>
> General
> -Chocolat
> -Billy
> -The Emperor's Groove
> -Toy Story
> Mystery
> -Ellen Brokovich
> -Pelican Brief
> Horror
> -Nightmare on Elm Street
> -Blair Witch Project
>
>Regards,
>
>Dan
>************
>File: MovieList.xml
><?xml-stylesheet type="text/xsl" href="MovieList.xsl"?>
><MovieList>
> <Movie>
> <Type>General</Type>
> <Title>Chocolat</Title>
> </Movie>
> <Movie>
> <Type>General</Type>
> <Title>Billy</Title>
> </Movie>
> <Movie>
> <Type>Mystery</Type>
> <Title>Ellen Brokovich</Title>
> </Movie>
> <Movie>
> <Type>Mystery</Type>
> <Title>Pelican Brief</Title>
> </Movie>
> <Movie>
> <Type>Horror</Type>
> <Title>Nightmare on Elm Street</Title>
> </Movie>
> <Movie>
> <Type>Horror</Type>
> <Title>Blair Witch Project</Title>
> </Movie>
> <Movie>
> <Type>General</Type>
> <Title>The Emperor's Groove</Title>
> </Movie>
> <Movie>
> <Type>General</Type>
> <Title>Toy Story</Title>
> </Movie>
></MovieList>
>
>File: MovieList.xsl
><?xml version="1.0"?>
>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:key name="MovieCategories" match="MovieList/Movie" use="Type"/>
>
> <xsl:template match="/">
> <xsl:for-each select="MovieList/Movie[Type and
>generate-id(.)=generate-id(key('MovieCategories',Type))]">
> <xsl:variable name="group" select="Type"/>
> <xsl:value-of select="$group"/><br/>
> <xsl:for-each select="/MovieList/Movie[Type=$group]">
> -<xsl:value-of select="Title"/><br/>
> </xsl:for-each>
> </xsl:for-each>
> </xsl:template>
></xsl:stylesheet>
>
> > Chocolat
> > Billy
> > Mystery
> > Ellen Brokovich
> > Pelican Brief
> > Horror
> > Nightmare on Elm Street
> > Blair Witch Project
> > The Emperor's Groove
> > Toy Story
>
>
>__________________________________________________
>Do You Yahoo!?
>Get email at your own domain with Yahoo! Mail.
>http://personal.mail.yahoo.com/
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list