[xsl] Generate-id() issue, well maybe?

Subject: [xsl] Generate-id() issue, well maybe?
From: "Ian E. Powell" <Ian.Powell@xxxxxxxxxxxxx>
Date: Thu, 18 Aug 2005 17:46:18 -0500
(XSL NEWBIE)
Th following produces the desired output asthetically, but the data is
coming out pretty skewed. 
Test file has (3) User Data Activty Elements
(1) The first stance of the User Element Prints the User name but no
data is output to the table.
(2) The second instance of the User Element creates the desired output
(for the most part) 
(3) The third instance creates the correct MDBService rows, but the
count is not correct (sometimes double)

What below is creating this erratic behaviour?


                 <xsl:for-each select="n1:User">
                        <br />
                        <xsl:for-each select="n1:Name">
                            <span style="font-family:Arial;
font-weight:bold; ">
                                <xsl:apply-templates />
                            </span>
                        </xsl:for-each>
                        <table border="1"
style="border-collapse:collapse ; width: 678px; " cellpadding="1" >
                            <thead>
                                <tr bgcolor="C5D8FF"
style="font-family:Arial; font-weight:bold">
                                    <td align="left" width="556">MDB
SERVICE</td>
                                    <td align="center"
width="61">MCAP</td>
                                    <td align="center"
width="61">HSS</td>
                                </tr>
                            </thead>
                            <tbody style="font-family:Arial;">
                                <xsl:for-each
select="n1:Activity[generate-id(.) =
generate-id(key('service',n1:MDBService)[1] )]">
		<xsl:variable name="temp_1" select="n1:MDBService"/>
                                    <tr>
                                        <td align="left">
                                            <xsl:value-of
select="$temp_1" />
                                        </td>
                                        <td align="center" width="61" >
		<xsl:value-of
select="count(key('service',$temp_1)[n1:MDBDivision ='MCAP'])"/>
		</td>
                                        <td align="center" width="61" >
		<xsl:value-of
select="count(key('service',$temp_1)[n1:MDBDivision ='HSS'])"/>
		</td>
                                    </tr>
                                </xsl:for-each>
                            </tbody>
		<tfoot>
		<tr style=" font-family:Arial; font-size:smaller ;
align:center;">
		<td height="15" colspan="3" align="center">
		MCAP = Medical Capital Intelligence Products
HSS = Healthcare Systems and Software Products
		</td>
		</tr>
	</tfoot>
                        </table>
                    </xsl:for-each>


Example User Element 

<User ID="111911">
	<Name>Robert Gerick</Name>
	<Activity>
		<MDBService>Intelligence Rep: Full</MDBService>
		<Description>Computerized Patient Record</Description>
		<SendDate>2/18/2002</SendDate>
		<MDBDivision>HSS</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Intelligence Rep: Fast</MDBService>
		<Description>Picture Archive and Communication Systems -
PACS</Description>
		<SendDate>2/18/2002</SendDate>
		<MDBDivision>MCAP</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Price Analysis</MDBService>
		<Description>Picture Archive and Communication Systems -
PACS</Description>
		<SendDate>2/18/2002</SendDate>
		<MDBDivision>HSS</MDBDivision>
	</Activity>
	<Activity>
		<MDBService>Intelligence Rep: Full</MDBService>
		<Description>Ambulatory Care System</Description>
		<SendDate>2/18/2002</SendDate>
		<MDBDivision>MCAP</MDBDivision>
	</Activity>
	<Activity>
</User>

_________________________________________________________________

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