Subject: Re: [xsl] Urgent please folks, need help wih 'paging' and nested grouping-by From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 03 Jan 2001 08:52:22 -0500 |
I have a flat file of <row> elements like this:
<row Ent_ID="1" Ent_1="Manos" Ent_2="Batsis" Ent_3="developer"> <row Ent_ID="1" Ent_1="Helen" Ent_2="Crown" Ent_3="secretary"> <row Ent_ID="1" Ent_1="Manos" Ent_2="Dollan" Ent_3="programmer"> <!-- [...] --> <row Ent_ID="10" Ent_1="Mickael" Ent_2="Crown" Ent_3="copyrighter">
My result file should devide the flat file to mixed <page> and <GroupBy > elements. These can be nested within eachother; the <page> element is used to hold up to 10 records,
while the <GroupBy > elements are used to devide the records into (what else?) groups. These groups can be based on any attribute of the records and can contain more levels of grouping, as well as other <page> elements (if the members of a group are more than ten):
So, we have multiple sorting and paging on a hard deadline. I receive the attributes I base my grouping upon as parameters, let's say there are three of them and their priority is as $param1, $param2, $param3.
Any help towards the right direction, would be much, much appreciated.
t:\ftemp>type manos.xml <rows> <row Ent_ID="1" Ent_1="Manos" Ent_2="Batsis" Ent_3="developer"/> <row Ent_ID="1" Ent_1="Helen" Ent_2="Crown" Ent_3="secretary"/> <row Ent_ID="1" Ent_1="Manos" Ent_2="Dollan" Ent_3="programmer"/> <row Ent_ID="2" Ent_1="Manos" Ent_2="Batsis" Ent_3="developer1"/> <row Ent_ID="2" Ent_1="Helen" Ent_2="Crown" Ent_3="secretary"/> <row Ent_ID="2" Ent_1="Manos" Ent_2="Dollan" Ent_3="programmer"/> <row Ent_ID="1" Ent_1="Manos" Ent_2="Batsis" Ent_3="developer2"/> <row Ent_ID="1" Ent_1="Helen" Ent_2="Crown" Ent_3="secretary"/> <row Ent_ID="1" Ent_1="Manos" Ent_2="Dollan" Ent_3="programmer"/> <row Ent_ID="10" Ent_1="Mickael" Ent_2="Crown" Ent_3="copyrighter"/> </rows> t:\ftemp>type manos.xsl <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="a1" select="'Ent_ID'"/> <xsl:param name="a2" select="'Ent_1'"/> <xsl:param name="a3" select="'Ent_2'"/>
t:\ftemp>type manos.out <?xml version="1.0" encoding="utf-8"?> <page> <GroupBy GroupByFields="Ent_ID"> <GroupBy GroupByFields="Ent_1"> <GroupBy GroupByFields="Ent_2"> <row Ent_ID="1" Ent_1="Helen" Ent_2="Crown" Ent_3="secretary"/> <row Ent_ID="1" Ent_1="Helen" Ent_2="Crown" Ent_3="secretary"/> </GroupBy> </GroupBy> <GroupBy GroupByFields="Ent_1"> <GroupBy GroupByFields="Ent_2"> <row Ent_ID="1" Ent_1="Manos" Ent_2="Batsis" Ent_3="developer"/> <row Ent_ID="1" Ent_1="Manos" Ent_2="Batsis" Ent_3="developer2"/> </GroupBy> <GroupBy GroupByFields="Ent_2"> <row Ent_ID="1" Ent_1="Manos" Ent_2="Dollan" Ent_3="programmer"/> <row Ent_ID="1" Ent_1="Manos" Ent_2="Dollan" Ent_3="programmer"/> </GroupBy> </GroupBy> </GroupBy> <GroupBy GroupByFields="Ent_ID"> <GroupBy GroupByFields="Ent_1"> <GroupBy GroupByFields="Ent_2"> <row Ent_ID="10" Ent_1="Mickael" Ent_2="Crown" Ent_3="copyrighter"/> </GroupBy> </GroupBy> </GroupBy> <GroupBy GroupByFields="Ent_ID"> <GroupBy GroupByFields="Ent_1"> <GroupBy GroupByFields="Ent_2"> <row Ent_ID="2" Ent_1="Helen" Ent_2="Crown" Ent_3="secretary"/> </GroupBy> </GroupBy> <GroupBy GroupByFields="Ent_1"> <GroupBy GroupByFields="Ent_2"> <row Ent_ID="2" Ent_1="Manos" Ent_2="Batsis" Ent_3="developer1"/> </GroupBy> <GroupBy GroupByFields="Ent_2"> <row Ent_ID="2" Ent_1="Manos" Ent_2="Dollan" Ent_3="programmer"/> </GroupBy> </GroupBy> </GroupBy> </page>
-- Training Blitz: 3-days XSLT/XPath, 2-days XSLFO - Feb 18-22, 2002
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) ISBN 0-13-065196-6 Definitive XSLT & XPath ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-07-1 Practical Formatting Using XSLFO XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed), articles, training(instructor-live,Internet-live,web/CD,licensed) Next public training: 2002-01-10,11,16,18,02-11,12,13,15,18,21, - 03-11,14,15,18,19,04-08,09,10,12
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Thread | Re: [xsl] Urgent please folks, need, G. Ken Holman | |
Date | RE: [xsl] XPath Expressions inside , Michael Kay | |
Month |