I hope i'm sending this to the right list: Attached is a diff to esql.xsl from the cocoon2rc1 release.
I have a change to the esql taglib which allows you to do something like this: <esql:execute-query> <esql:query> select committeeName, title, firstName, middleName, lastName, suffix, status from committeeMember left join directoryInformation using(userid) left join committee on committee.id=committeeMember.committeeid order by committeeName asc </esql:query> <esql:results> <esql:row-results> <esql:group group-on="committeeName"> <h2><esql:get-string column="committeeName"/></h2> <ul> <esql:member> <li> <esql:get-string column="title"/> <esql:get-string column="firstName"/> <esql:get-string column="middleName"/> <esql:get-string column="lastName"/> <esql:get-string column="suffix"/> </li> </esql:member> </ul> </esql:group> </esql:row-results> </esql:results> </esql:execute-query> That is, you can do table joins and then insert a header and footer whenever a "watched" column value changes. It follows the nesting ideology of <xsp:logic>...<xsp:content></></> You can nest <esql:group> and <esql:member> indefinately. I didn't update the schema, and it is probably undercommented... especially since i didn't insert the xsp-doc stuff that would automatically stick documentation for it on the esql website page. I'll make any adjustments necesarry to it to make it more worthy of inclusion in the released version. Tim Myers Student Technology Services The Johns Hopkins University
Index: esql.xsl =================================================================== RCS file: /var/cvs/stserv/edu/jhu/hcf/stserv/logicsheets/esql.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- esql.xsl 2001/10/25 20:17:00 1.1 +++ esql.xsl 2001/10/25 20:18:32 1.2 @@ -1,12 +1,12 @@ <?xml version="1.0"?> -<!-- $Id: esql.xsl,v 1.1 2001/10/25 20:17:00 phantom Exp $--> +<!-- $Id: esql.xsl,v 1.2 2001/10/25 20:18:32 phantom Exp $--> <!-- ============================================================================ The Apache Software License, Version 1.2 ============================================================================ - Copyright (C) @year@ The Apache Software Foundation. All rights reserved. + Copyright (C) 1999-2001 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: @@ -678,22 +678,91 @@ </xsl:template> <xsl:template match="esql:results//esql:row-results"> + <xsl:variable name="group" select=".//esql:group"/> <xsp:logic> + boolean keepgoing=false; + + //create booleans for group change watches and strings for old values. + <xsl:apply-templates select=".//esql:group" mode="vars"/> + do { <xsp:content> <xsl:apply-templates/> </xsp:content> - if (_esql_connection.use_limit_clause == 0 && _esql_query.max_rows != -1 && _esql_query.position - _esql_query.skip_rows == _esql_query.max_rows-1) { - _esql_query.position++; - break; - } - _esql_query.position++; - } while (_esql_query.resultset.next()); + <xsl:if test="count($group) < 1"> + <xsl:call-template name="nextRow"/> + </xsl:if> + } while (keepgoing); if (_esql_query.resultset.next()) { <xsl:apply-templates select="following-sibling::esql:more-results" mode="more"/> _esql_query.position++; } + </xsp:logic> +</xsl:template> + +<xsl:template name="nextRow"> + //checking out early? + if ( _esql_connection.use_limit_clause == 0 && + _esql_query.max_rows != -1 && + _esql_query.position - _esql_query.skip_rows == _esql_query.max_rows-1) { + _esql_query.position++; + keepgoing = false; + } else { //if not, advance normally + keepgoing = _esql_query.resultset.next(); + _esql_query.position++; + } +</xsl:template> + +<xsl:template match="esql:group" mode="vars"> + boolean <xsl:value-of select="@group-on"/>Changed = true; + String <xsl:value-of select="@group-on"/>Old; +</xsl:template> + +<xsl:template match="esql:group"> +<xsp:logic> + if (<xsl:value-of select="@group-on"/>Changed){ + //header contents + <xsp:content> + <xsl:apply-templates> + <xsl:with-param name="group-on" select="@group-on"/> + </xsl:apply-templates> + </xsp:content> + } +</xsp:logic> +</xsl:template> + +<xsl:template match="esql:group//node()[.//esql:member]"> + <xsl:param name="group-on"/> + <xsl:copy> + <xsl:apply-templates select="@*|*|text()"> + <xsl:with-param name="group-on" select="$group-on"/> + </xsl:apply-templates> + </xsl:copy> +</xsl:template> + +<xsl:template match="esql:member"> + <xsl:param name="group-on"/> + <xsl:variable name="group" select=".//esql:group"/> + <xsp:logic> + } + <xsp:content> + <xsl:apply-templates> + <xsl:with-param name="group-on" select="$group-on"/> + </xsl:apply-templates> + </xsp:content> + <xsl:value-of select="$group-on"/>Old = +_esql_query.resultset.getString("<xsl:value-of select="$group-on"/>"); + + <xsl:if test="count($group) < 1"> + <xsl:call-template name="nextRow"/> + </xsl:if> + if (keepgoing) { + <xsl:value-of select="$group-on"/>Changed = <xsl:value-of +select="$group-on"/>Old.equals(_esql_query.resultset.getString("<xsl:value-of +select="$group-on"/>")); + } else { + <xsl:value-of select="$group-on"/>Changed = true; + } + if (<xsl:value-of select="$group-on"/>Changed) { + //footer contents </xsp:logic> </xsl:template>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]