[xsl] XSLT logic problem

Subject: [xsl] XSLT logic problem
From: Siddharth Jain <sidjain81@xxxxxxxxx>
Date: Mon, 8 Nov 2004 14:36:13 +0530
Hi,
I am a novice in XSLT and have a problem.

I have a XML of the following kind which i recieve from the database.
<ROWSET>
<ROW num="1">
     <CORE_ID>Core 1</CORE_ID>
     <CORE_EFF_START_DT>04-SEP-2004</CORE_EFF_START_DT>
     <CORE_EFF_END_DT>31-DEC-2050</CORE_EFF_END_DT>
     <MPN_CD>Device 1</MPN_CD>
     <MPN_DESC>Device 1 description</MPN_DESC>
     <MPN_EFF_START_DT>04-SEP-2004</MPN_EFF_START_DT>
     <MPN_EFF_END_DT>31-DEC-2050</MPN_EFF_END_DT>
  </ROW>
  <ROW num="2">
     <CORE_ID>Core 1</CORE_ID>
     <CORE_EFF_START_DT>04-SEP-2004</CORE_EFF_START_DT>
     <CORE_EFF_END_DT>31-DEC-2050</CORE_EFF_END_DT>
     <MPN_CD>Device 2</MPN_CD>
     <MPN_DESC>Device 2 description</MPN_DESC>
     <MPN_EFF_START_DT>24-SEP-2004</MPN_EFF_START_DT>
     <MPN_EFF_END_DT>31-DEC-2050</MPN_EFF_END_DT>
  </ROW>
 <ROW num="3">
     <CORE_ID>Core 2</CORE_ID>
     <CORE_EFF_START_DT>04-SEP-2004</CORE_EFF_START_DT>
     <CORE_EFF_END_DT>31-DEC-2050</CORE_EFF_END_DT>
     <MPN_CD>Device 1</MPN_CD>
     <MPN_DESC>Device 1 description</MPN_DESC>
     <MPN_EFF_START_DT>12-OCT-2004</MPN_EFF_START_DT>
     <MPN_EFF_END_DT>31-DEC-2050</MPN_EFF_END_DT>
  </ROW>
</ROWSET>

The CORE_ID is associated to a core product and MPN_CD is associated
to a device product.
Also,
1. One core product can have many device products. (i needed a
hierarchy where all device products associated to a single core
product were displayed together. I took care of this using grouping)
2. One device product can be in more than one core product.

The condition is as follows:
For a device product,
if MPN_EFF_END_DT < CurrentDate  => inactive
else                                                 => active

So a device product can be active/inactive. It could be active under
one core product and inactive under another core product.

What is required:  If in a case where one device product occurs in
more than one core product and in one of the cases the device product
is found to be inactive, then that device product should not be
displayed instead only the active ones under other core products
should be displayed.
Moreover, if in a case, where one device product occurs in more than
one core product and in all of these the device product is found to be
inactive, then the device product should be displayed.

Please help me out with a logic as to how should i go about
implementing this. If anyone can give me a sample code that will be
the best.

Thanks & Regards,
Siddharth.

Current Thread