|
My favorite way to do this involves an xslt 2.0 stylesheet and the data
in an xml format. Assuming you data looks something like this. --------------------------------------- <data> <record> <category>cat 1</category> <subject>sub a</subject> </record> <record> <category>cat 2</category> <subject>sub b</subject> </record> <record> <category>cat 2</category> <subject>sub c</subject> </record> </data> --------------------------------------- your xsl would incorporate this snippet (common xslt code removed for clarity) --------------------------------------- <ul> <xsl:for-each-group select="/data/record" group-by="category"> <li><xsl:value-of select="category"/> <ul> <xsl:for-each select="current-group()"> <li><xsl:value-of select="subject"/></li> </xsl:for-each> </ul> </li> </xsl:for-each-group> </ul> --------------------------------------- notice the "for-each-group" xsl element. It's wicked powerful, and only available in 2.0. You could do some stuff with xsl 1.0, but this is by far an easier way to look at it. there's just one caveat... XSL 2.0 is not supported by the xsl libraries included with witango and it's @XSLT tag we wrote our own bean to call from witango and executed the SAXON Transform method from that bean. /John Robert Garcia wrote: There are many ways to skin this, this is how I do these kinds of things. Feels cleaner to me, but doesn't make it better. -- John McGowan [EMAIL PROTECTED] P 847.608.6900 x 110 F 847.608.9501 ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf |
- RE: Witango-Talk: Creating an index WebDude
- Re: Witango-Talk: Creating an index Alan Wolfe
- RE: Witango-Talk: Creating an index WebDude
- Re: Witango-Talk: Creating an index Alan Wolfe
- Re: Witango-Talk: Creating an index Ben Johansen
- RE: Witango-Talk: Creating an index WebDude
- Re: Witango-Talk: Creating an inde... Alan Wolfe
- Re: Witango-Talk: Creating an inde... Ben Johansen
- Re: Witango-Talk: Creating an index Robert Garcia
- Re: Witango-Talk: Creating an index Robert Garcia
- Re: Witango-Talk: Creating an index John McGowan
