[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Multiple Grouping & Muenchian Method
Hi All
Is it possible to have a group within a group. I did look at http://www.biglist.com/lists/xsl-list/archives/200101/msg00070.html but I either get a date with data from both dates or the same date for each data set. Thank You Steve
EUR Group Name id CCC George 24567 CCC Harold 23458 CCC Jennifer 23459 07-14-2006 USA Group Name id BBB Dave 12345 BBB Ethel 12346 BBB Fred 12347 EUR Group Name id CCC George 24567 CCC Harold 23458 CCC Jennifer 23459 ===================================== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" /> <xsl:key name="by-date" match="entry" use="date" /> <xsl:key name="by-country" match="entry" use="country" /> <xsl:template match="/report"> <html> <head> <title/> </head> <body> <table border="1"> <xsl:variable name="break_by_date" select="//entry[key('by-date', date)]"/> <xsl:variable name="break_by_country" select="key('by-country', currency)"/> <xsl:for-each select="$break_by_date[generate-id() = generate-id(key('by-country', country)[1])]"> <tr> <td><xsl:value-of select="date"/></td> </tr> <tr> <td><xsl:value-of select="country" /></td> </tr> <tr> <td>Group</td> <td>Name</td> <td>id</td> </tr> <xsl:for-each select="key('by-country', country)"> <tr> <td><xsl:value-of select="../@type" /></td> <td><xsl:value-of select="name" /></td> <td><xsl:value-of select="id" /></td> </tr> </xsl:for-each> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> Sample XML file <report> <table> <date>07-13-2006 <group type="AAA">111111 <entry> <date>07-13-2006</date> <name>Adel</name> <country>USA</country> <id>12345</id> </entry> <entry> <date>07-13-2006</date> <name>Barry</name> <country>USA</country> <id>12346</id> </entry> <entry> <date>07-13-2006</date> <name>Carl</name> <country>USA</country> <id>12347</id> </entry> </group> <group type="BBB">111111 <entry> <date>07-13-2006</date> <name>Dave</name> <country>USA</country> <id>12345</id> </entry> <entry> <date>07-13-2006</date> <name>Ethel</name> <country>USA</country> <id>12346</id> </entry> <entry> <date>07-13-2006</date> <name>Fred</name> <country>USA</country> <id>12347</id> </entry> </group> <group type="CCC">111111 <entry> <date>07-13-2006</date> <name>George</name> <country>EUR</country> <id>24567</id> </entry> <entry> <date>07-13-2006</date> <name>Harold</name> <country>EUR</country> <id>23458</id> </entry> <entry> <date>07-13-2006</date> <name>Jennifer</name> <country>EUR</country> <id>23459</id> </entry> </group> </date> <date>07-14-2006 <group type="BBB">111111 <entry> <date>07-14-2006</date> <name>Dave</name> <country>USA</country> <id>12345</id> </entry> <entry> <date>07-14-2006</date> <name>Ethel</name> <country>USA</country> <id>12346</id> </entry> <entry> <date>07-14-2006</date> <name>Fred</name> <country>USA</country> <id>12347</id> </entry> </group> <group type="CCC">111111 <entry> <date>07-14-2006</date> <name>George</name> <country>EUR</country> <id>24567</id> </entry> <entry> <date>07-14-2006</date> <name>Harold</name> <country>EUR</country> <id>23458</id> </entry> <entry> <date>07-14-2006</date> <name>Jennifer</name> <country>EUR</country> <id>23459</id> </entry> </group> </date> </table> </report>
|
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
|