Subject: Re: [xsl] Grouping by key From: gopinath.emmidisetty@xxxxxxxxxxxxxxxxxxxxxxxxx Date: Thu, 2 Dec 2004 16:19:51 +0000 |
Hi, Here is the working xsl file. I have removed the select with null string for <xsl:param name="collapse" /> as suggested. It is still not working. I have now commented the code between <xsl:if> and</xsl:if> elements so it is working with collapsing all categories. So, it works without <xsl:template match="/"> block. If I remove the <xsl:if> and</xsl:if> elements and retain the code between the elements, it works expanding all categories, ie., displaying all records for that category. cheers . XSL file: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="catCol" select="2"/> <xsl:param name="indent" select="' '"/> <xsl:param name="collapse"/> <xsl:param name="columnHeaders"> <header>CompanyName</header> <header>AccountNumber</header> <header>Town</header> <header>Postcode</header> <header>Phone</header> </xsl:param> <xsl:key name="categorise" match="account" use="*[@colno='2']" /> <!-- First <xsl:if test="$collapse=1"> <xsl:template match="/"> <div> <xsl:apply-templates select="documents" /> </div> </xsl:template> </xsl:if> --> <xsl:template match="documents"> <table> <xsl:apply-templates select="account[generate-id() = generate-id( key( 'categorise', *[@colno=$catCol] )[1] )]" mode="catcols"> <xsl:sort select="*[@colno=$catCol]"/> </xsl:apply-templates> </table> </xsl:template> <xsl:template match="account" mode="catcols"> <xsl:if test="position()=1"> <tr> <th> <xsl:value-of select="msxsl:node-set($columnHeaders)/header[position()=3]" /> </th> <th><xsl:value-of select="msxsl:node-set($columnHeaders)/header[position()=1]" /> </th> <th> <xsl:value-of select="msxsl:node-set($columnHeaders)/header[position()=2]" /> </th> <th> <xsl:value-of select="msxsl:node-set($columnHeaders)/header[position()=4]" /> </th> <th> <xsl:value-of select="msxsl:node-set($columnHeaders)/header[position()=5]" /> </th> </tr> </xsl:if> <tr class="resultCategory"> <td colspan="5"> <!-- <div id="<xsl:value-of select="*[@colno=$catCol]" />" --> <div><b><xsl:value-of select="*[@colno=$catCol]" /></b> ( <xsl:value-of select="count(.|key( 'categorise', *[@colno=$catCol] ) )" /> )</div> </td> <!-- Second <xsl:if test="$collapse=1"> <xsl:apply-templates select="key('categorise', *[@colno=$catCol])" mode="catrows" /> </xsl:if> --> </tr> </xsl:template> <!-- Third <xsl:if test="$collapse=1"> <xsl:template match="account" mode="catrows"> <tr class=""> <xsl:if test="position() mod 2 != 1"> <xsl:attribute name="class">resultAlternate</xsl:attribute> </xsl:if> <td width="40"> <xsl:value-of select="$indent" /> </td> <td width="300"> <a> <xsl:attribute name="href"> /mail/goemmidi.nsf/formAccountView?open&window=1&ac=<xsl:value-of select="*[@colno=1]" />&source=<xsl:value-of select="*[@colno=8]" />&custtype=<xsl:value-of select="*[@colno=5]" />&mktseg=<xsl:value-of select="*[@colno=9]" /> </xsl:attribute><xsl:value-of select="*[@colno=0]" /></a> </td> <td width="100"> <xsl:value-of select="*[@colno=1]" /> </td> <td width="100"> <xsl:value-of select="*[@colno=3]" /> </td> <td width="100"> <xsl:value-of select="*[@colno=4]" /> </td> </tr> </xsl:template> </xsl:if> --> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping by key, David Carlisle | Thread | [xsl] XSLT documentation extracxtio, Timon Antimon |
Re: [xsl] SVG and Presentations at , Bruce D'Arcus | Date | Re: [xsl] SVG and Presentations at , Wendell Piez |
Month |