[xsl] Count() on Distinct, but want to include additional condition

Subject: [xsl] Count() on Distinct, but want to include additional condition
From: "Ian E. Powell" <Ian.Powell@xxxxxxxxxxxxx>
Date: Wed, 10 Aug 2005 10:06:07 -0500
I am having a lil issue with a count(distinct element) situation. I am
pretty new to XSLT scripting and the issue seems rather trivial.
Generating the Unique MDBService elements works great but I also want to
include 2 counts per distinct MDBservice based upon MDBDivision.
(ie) count(  MDBService and MDBDivision = "MCAP") & count(  MDBService
and MDBDivision = "HSS")

<xsl:key name="service" match="Activity" use="MDBService"/>
.
.....

<xsl:for-each select="Facility">
	<table width="700" border="1">
	<tbody>
	<xsl:for-each select="Activity[generate-id(.) =
generate-id(key('service',MDBService)[1])]">
		<tr>
		<td>
		<xsl:value-of select="MDBService"/>
		</td>
		<td align="center" width="15%">
		<xsl:value-of select="count("based on MDBDivision =
MCAP")"/>
		</td>
		<td align="center" width="15%">
		<xsl:value-of select="count("based on MDBDivision =
HSS")"/>
		</td>
		</tr>
	</xsl:for-each>
	</tbody>
	</table>
</xsl:for-each>

XML INPUT

<Facility>
	<Name>Jefferson Memorial Hospital</Name>
	<DateRange>1/23/2005 To 7/23/2005</DateRange>
	<Activity>
		<MDBService>User Satisfaction Trending</MDBService>
		<Description>Sleep Assessment Unit, Computerized,
Respironics, Inc.</Description>
		<SendDate>2/3/2005</SendDate>
		<MDBDivision>HSS</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Price Analysis</MDBService>
		<Description>Patient Monitoring, GE Healthcare-IT
Division</Description>
		<SendDate>1/25/2005</SendDate>
		<MDBDivision>MCAP</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Price Analysis</MDBService>
		<Description>Oncology Information Management System,
Siemens Medical Solutions USA, Inc.</Description>
		<SendDate>2/2/2005</SendDate>
		<MDBDivision>HSS</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Capital Needs Assessment</MDBService>
		<Description>Analyzer, Pulmonary Function</Description>
		<SendDate>2/3/2005</SendDate>
		<MDBDivision>MCAP</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Intelligence Rep: Full</MDBService>
		<Description>Analyzer, Pulmonary Function</Description>
		<SendDate>2/3/2005</SendDate>
		<MDBDivision>HSS</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Intelligence Rep: Full</MDBService>
		<Description>Analyzer, Pulmonary Function</Description>
		<SendDate>2/3/2005</SendDate>
		<MDBDivision>MCAP</MDBDivision>
	</Activity>
</Facility>

_________________________________________________________________

This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you
have received it in error, please notify the sender immediately
and delete the original. Any other use of the email by you is 
prohibited.
_________________________________________________________________

Current Thread