[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Mandatory and Missing Columns

Subject: Mandatory and Missing Columns
From: Shashank Jain <shashankjain@xxxxxxxx>
Date: Mon, 5 Apr 2010 16:58:18 -0500
 Mandatory and Missing Columns
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 complete="N">
        <document_type complete="Y"
sp_document_type="Stock Report"/>

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

      <event complete="N">

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



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

complete="N" />

      <event complete="N">

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

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


      <event complete="N">

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

      <event complete="N">

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

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



First column list all the sp_document_types
Stock Report
EPS Model
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() =
   <xsl:value-of select="@sp_document_type"/>

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

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.

Shashank Jain

The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.