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="*[(_at_)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', *[(_at_)colno=$catCol] )[1] )]"
mode="catcols">
<xsl:sort select="*[(_at_)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="*[(_at_)colno=$catCol]" />" -->
<div><b><xsl:value-of
select="*[(_at_)colno=$catCol]" /></b> ( <xsl:value-of select="count(.|key(
'categorise', *[(_at_)colno=$catCol] ) )" /> )</div>
</td>
<!-- Second <xsl:if test="$collapse=1">
<xsl:apply-templates select="key('categorise',
*[(_at_)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="*[(_at_)colno=1]"
/>&source=<xsl:value-of select="*[(_at_)colno=8]"
/>&custtype=<xsl:value-of select="*[(_at_)colno=5]"
/>&mktseg=<xsl:value-of select="*[(_at_)colno=9]" />
</xsl:attribute><xsl:value-of select="*[(_at_)colno=0]"
/></a>
</td>
<td width="100"> <xsl:value-of select="*[(_at_)colno=1]" />
</td>
<td width="100"> <xsl:value-of select="*[(_at_)colno=3]" />
</td>
<td width="100"> <xsl:value-of select="*[(_at_)colno=4]" />
</td>
</tr>
</xsl:template>
</xsl:if> -->
</xsl:stylesheet>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--