[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] Generate-id() issue, well maybe?
From: omprakash.v@xxxxxxxxxxxxx
Date: Fri, 19 Aug 2005 09:03:42 +0530

Hi,
        The elements in the input xml are in no namepsace. Why then do you
have n1:User, n1:Activity etc in your templates.It is enough if you had

<xsl:template match="User"> and so on in your stylesheet.

Hope this helps.

Cheers,
prakash






                                                                                                                                       
                      "Ian E. Powell"                                                                                                  
                      <Ian.Powell@mdbu         To:      <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                                              
                      yline.com>               cc:      (bcc: omprakash.v/Polaris)                                                     
                                               Subject: [xsl]  Generate-id()  issue,  well maybe?                                      
                      08/19/2005 04:16                                                                                                 
                      AM                                                                                                               
                      Please respond                                                                                                   
                      to xsl-list                                                                                                      
                                                                                                                                       
                                                                                                                                       





(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.
_________________________________________________________________





This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in


Current Thread
Keywords
xml