G
Graham
Hi,
I am in need of help trying to count the number of records that a Key
group contains. I am a newbie and apologise if this seems a dumb
request!
I have the following XSLT and keep getting zero returned.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Define keys used to group elements -->
<xsl:key name="keyContactGUID" match="result"
use="objectid.contactid"/>
<xsl:template match="/">
<!-- autonumber for the sorting id column -->
<html>
<body>
<h2>Grouping Test</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Contact</th>
<th># of Visits</th>
<th>Account</th>
</tr>
<xsl:variable name="CC"
select="count(key('keyContactGUID',objectid.contactid))"/>
<!-- Process each Contact-->
<xsl:for-each select="//result[generate-id(.) =
generate-id(key('keyContactGUID',objectid.contactid)[1])]">
<tr>
<xsl:variable name="CID">
<xsl:value-of select="objectid.contactid"/>
</xsl:variable>
<td>
<xsl:value-of select="objectid.fullname"/>
<p/>
</td>
<td>
<xsl:value-of
select="count(key('keyContactGUID',objectid.contactid)/activityid)"/>
</td>
<td>
<xsl:value-of select="objectid.accountid/@name"/>
</td>
</tr>
</xsl:for-each>
</table>
<xsl:variable name="CC"
select="count(key('keyContactGUID',objectid.contactid))"/>
Count = <xsl:value-of select="$CC"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Thanks in advance
Graham.
I am in need of help trying to count the number of records that a Key
group contains. I am a newbie and apologise if this seems a dumb
request!
I have the following XSLT and keep getting zero returned.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Define keys used to group elements -->
<xsl:key name="keyContactGUID" match="result"
use="objectid.contactid"/>
<xsl:template match="/">
<!-- autonumber for the sorting id column -->
<html>
<body>
<h2>Grouping Test</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Contact</th>
<th># of Visits</th>
<th>Account</th>
</tr>
<xsl:variable name="CC"
select="count(key('keyContactGUID',objectid.contactid))"/>
<!-- Process each Contact-->
<xsl:for-each select="//result[generate-id(.) =
generate-id(key('keyContactGUID',objectid.contactid)[1])]">
<tr>
<xsl:variable name="CID">
<xsl:value-of select="objectid.contactid"/>
</xsl:variable>
<td>
<xsl:value-of select="objectid.fullname"/>
<p/>
</td>
<td>
<xsl:value-of
select="count(key('keyContactGUID',objectid.contactid)/activityid)"/>
</td>
<td>
<xsl:value-of select="objectid.accountid/@name"/>
</td>
</tr>
</xsl:for-each>
</table>
<xsl:variable name="CC"
select="count(key('keyContactGUID',objectid.contactid))"/>
Count = <xsl:value-of select="$CC"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Thanks in advance
Graham.