Altova Mailing List Archives


[xsl] Mandatory and Missing Columns

From: Shashank Jain <shashankjain@----.--->
To: <xsl-list@-----.------------.--->
Date: 4/5/2010 9:59:00 PM
Hello All,

I am trying to create a table which has 3 columns like

Stock Report  6  3



Report        0  0



EPS Model     7  5



Articles      0  0

DCF Model     4  3

first column list all the sp_document_types. Second Column list the total # of events in which the document type is mandatory and the third column list total number of events in which sp_document_type is missing.

Here is my XML

<data business_group_id="is_er">
   <event_template  sp_mand_doctypes="Research Note, Prior Stock Report - Edited / Reviewed, Stock Report">
      <event complete="N" />
      <event complete="N">
         <document_type complete="Y" sp_document_type="Stock Report"/>
         <document_type complete="Y" sp_document_type="Report"/>
      </event>
      <event complete="N">
        <document_type complete="Y" 
sp_document_type="Stock Report"/>
      </event>
   </event_template>

   <event_template  sp_mand_doctypes="EPS Model,Stock Report">
      <event 
complete="N" />
      <event complete="N">
         <document_type complete="Y" sp_document_type="EPS Model"/>
      
</event>

      <event complete="N">

        <document_type complete="Y" 
sp_document_type="Stock Report"/>

      </event>

   </event_template>

   <event_template  sp_mand_doctypes="DCF Model, EPS Model">

      <event 
complete="N" />

      <event complete="N">

         
<document_type complete="Y" sp_document_type="Articles"/>

        
 <document_type complete="Y" sp_document_type="EPS Model"/>

      
</event>


      <event complete="N">


        <document_type complete="Y" 
sp_document_type="Stock Report"/>


      </event>
      <event complete="N">


         
<document_type complete="Y" sp_document_type="Articles"/>


        
 <document_type complete="Y" sp_document_type="DCF Model"/>


      
</event>


   </event_template>
</data>

First column list all the sp_document_types
Stock Report
Report
EPS Model
Articles
DCF Model

For this I created one key function 
<xsl:key name="docType" match="document_type" use="@sp_document_type"/>

and used it like this

<xsl:for-each select="//document_type[generate-id() = generate-id(key('docType',@sp_document_type)[1])]">
<tr>
<td>
   <xsl:value-of select="@sp_document_type"/>
</td>
<tr>
</xsl:for-each>

I was able to achieve the first column. 

In the second column I want in how many events sp_document_type is required.
It means if we look at the first 'event_template' it has 3 mandatory documents (Research Note, Prior Stock Report - Edited / Reviewed, Stock Report) which should be present in the every 'event' child of event_template. But "Stock report" is present in only 2 'events' of that 'event_template'.
Similarly second event_template has 2mandatory documents "EPS Model" and "Stock report" and both the documents are present in one event but they were required in all the events.
So my table will look some thing like

Stock Report  3+3+0 (since Stock report is not required in 3rd event_template)

Report        0+0+0   (It is not required in any of the event_template)

EPS Model     0+3+4

Articles      0+0+0
DCF Model     0+0+4

In the thrid column I am trying to list total number of events in which 'sp_document_type' is missing.
It means, if we again look at the first event_template 'Stock Report' is one of the mandatory document but it is missing in one of the event of event_template. Similarly Stock Report is missing from the 2 of the events of the second event_template.
Stock Report  1+2+0 


Report        0+0+0   


EPS Model     0+2+3


Articles      0+0+0
DCF Model     0+0+3

I will appreciate if somebody can advice me in figuring out other two columns. 

Thanks
Shashank Jain


 		 	   		  
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
--~------------------------------------------------------------------
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@l...>
--~--

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.