Subject: Re: [xsl] Unique headers From: Dan Diebolt <dandiebolt@xxxxxxxxx> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Unique headers, Trevor Nash | Thread | Re: [xsl] Unique headers, Kanthi Damodaran |
[xsl] !!!counters in XSL!!!, Rosa I-Ting Cheng | Date | [xsl] Re: xsl to xsl doing it right, Dan Diebolt |
Month |