Solved

Eliminating duplicates in XML using XSlT..

Posted on 2009-05-15
17
407 Views
Last Modified: 2013-11-18
Hi Guys

I was hoping you could help me how to eliminate duplicates in XML using XSLT1.0
Below is my XML file
<softwareOffering>
<licensedFunction>
<licenseID>S0111R1</licenseID>
<description>Directory MaintenanceFac</description> <licenseOption>
<valueMetric>77D000</valueMetric>
<valueMetricDescription>Per Engine Registration</valueMetricDescription>
<chargeOption>NOCHARGE </chargeOption>
<chargeOptionDescription>No Charge</chargeOptionDescription>Charge</chargeOptionDescription>
<licenseType>SWSUBSUPRGST</licenseType>
<licenseTypeDescription>SW Subs and Sup t</licenseTypeDescription>
</licenseOption>
<licenseOption>
<valueMetric>4D9000</valueMetric>
<valueMetricDescription>Value Units</valueMetricDescription>
<chargeOption>CHINA4YEAR  </chargeOption>
<chargeOptionDescription>4 Year Support, China only</chargeOptionDescription>
<licenseType>SWSUBSCSUPPO</licenseType>
<licenseTypeDescription>SW Subscription and Support</licenseTypeDescription>
</licenseOption>
<licenseOption>
<valueMetric>4D9000</valueMetric>
<valueMetricDescription>Value Units</valueMetricDescription>
<chargeOption>ASC         </chargeOption>
<chargeOptionDescription>Annual Support Charge</chargeOptionDescription>
<licenseType>SWSUBSCSUPPO</licenseType>
<licenseTypeDescription>SW Subscription and Support</licenseTypeDescription>
</licenseOption>
<licenseOption>
<valueMetric>4D9000</valueMetric>
<valueMetricDescription>Value Units</valueMetricDescription>
<chargeOption>MSC         </chargeOption>
<chargeOptionDescription>Monthly Support Charge</chargeOptionDescription>
<licenseType>SWSUBSCSUPPO</licenseType>
<licenseTypeDescription>SW Subscription and Support</licenseTypeDescription>
</licenseOption>
</licensedFunction>
<licensedFunction>
<licenseID>S0111PZ</licenseID>
<description>Performance Toolkit for VM</description>
<licenseOption>
<valueMetric>77D000</valueMetric>
<valueMetricDescription>Per Engine Registration</valueMetricDescription>
<chargeOption>NOCHARGE    </chargeOption>
<chargeOptionDescription>No Charge</chargeOptionDescription>
<licenseType>SWSUBSUPRGST</licenseType>
<licenseTypeDescription>SW Subs and Sup Rgst</licenseTypeDescription>
</licenseOption>
<licenseOption>
<valueMetric>4D9000</valueMetric>
<valueMetricDescription>Value Units</valueMetricDescription>
<chargeOption>CHINA4YEAR  </chargeOption>
<chargeOptionDescription>4 Year Support, China only</chargeOptionDescription>
<licenseType>SWSUBSCSUPPO</licenseType>
<licenseTypeDescription>SW Subscription and Support</licenseTypeDescription>
</licenseOption>
<licenseOption>
<valueMetric>4D9000</valueMetric>
<valueMetricDescription>Value Units</valueMetricDescription>
<chargeOption>ASC     </chargeOption>
<chargeOptionDescription>Annual Support Charge</chargeOptionDescription>
<licenseType>SWSUBSCSUPPO</licenseType>
<licenseTypeDescription>SW Subscription and Support</licenseTypeDescription>
</licenseOption>
</licensefunction>


Here i want to print LIcenseID,ValueMetric,ValueMetric Description..
ease consider as high priorty

Here is my xsl which is not eliminating duplicates in xslt
<xsl:key name="valueMetric" match="..//licenseOption" use="valueMetric" />
  <!--  Output method  -->
  <xsl:output method="html" omit-xml-declaration="yes" indent="yes" />
<xsl:for-each select="../licensedFunction/licenseID>
  <xsl:for-each select="licenseOption[count(. | key('valueMetric', valueMetric)[1]) = 1]">
    <tr>
  <xsl:if test="(position() mod 2 = 0)">
  <xsl:attribute name="class">gray</xsl:attribute>
  </xsl:if>
  <td>
  <xsl:variable name="valuemetricid" select="valueMetric" />
  <xsl:variable name="licenceid" select="../licenseID" />
  <small>
  <a href="{contextRoot}{servletPath}iSoftwareorderinfoseb2_result.jsp?type=Licence&licenceid={$licenceid}&valuemetricid={$valuemetricid}">
  <xsl:value-of select="../../productId/typeCode" />
  <xsl:value-of select="../../productId/modelCode" />
  </a>
  </small>
  </td>
 <td nowrap="1">
 <small>
  <xsl:value-of select="../licenseID" />
   <xsl:value-of select="valueMetric" />
  </small>
  </td>
   <td nowrap="1">
  <small>
  <xsl:value-of select="valueMetricDescription" />
  </small>
  </td>
  <td nowrap="1">
  <small>CHARGE</small>
  <script type="text/javascript">v++;</script>
  </td>
  </tr>
  </xsl:for-each>
</xsl:stylesheet>
Thanks

0
Comment
Question by:kommichowdary
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
17 Comments
 
LVL 60

Assisted Solution

by:Geert Bormans
Geert Bormans earned 500 total points
ID: 24393890
I think this is what you need
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
    <xsl:key name="uniq" match="licenseOption" use="concat(../licenseID, valueMetric, valueMetricDescription)"/>
    <xsl:template match="softwareOffering">
    <table border="1">
        <tr>
            <th>LicenseID</th>
            <th>ValueMetric</th>
            <th>ValueMetric Description</th>
        </tr>
        <xsl:apply-templates select="licensedFunction/licenseOption[generate-id() = generate-id(key('uniq', concat(../licenseID, valueMetric, valueMetricDescription))[1])]">
 
        </xsl:apply-templates>
    </table>
</xsl:template>
    <xsl:template match="licenseOption">
        <tr>
            <td><xsl:value-of select="../licenseID"/></td>
            <td><xsl:value-of select="valueMetric"/></td>
            <td><xsl:value-of select="valueMetricDescription"/></td>
        </tr>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24393893
The technique I use for unique fields is known as muenchian grouping
http://www.jenitennison.com/xslt/grouping/muenchian.html
0
 

Author Comment

by:kommichowdary
ID: 24395179
Can u make it elaborate ...
<softwareOffering><licensedFunction><licenseID>S0111R1</licenseID><description>Directory Maintenance Fac</description><licenseOption><valueMetric>77D000</valueMetric><valueMetricDescription>Per Engine Registration</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>SWSUBSUPRGST</licenseType><licenseTypeDescription>SW Subs and Sup Rgst</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>CHINA4YEAR  </chargeOption><chargeOptionDescription>4 Year Support, China only</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ASC         </chargeOption><chargeOptionDescription>Annual Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>MSC         </chargeOption><chargeOptionDescription>Monthly Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>DECLINESANDS</licenseType><licenseTypeDescription>Decline Subscribe and Suppt.</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ONEYRRESEL  </chargeOption><chargeOptionDescription>Reseller One Year</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption></licensedFunction><licensedFunction><licenseID>S0111PZ</licenseID><description>Performance Toolkit for VM</description><licenseOption><valueMetric>77D000</valueMetric><valueMetricDescription>Per Engine Registration</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>SWSUBSUPRGST</licenseType><licenseTypeDescription>SW Subs and Sup Rgst</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>CHINA4YEAR  </chargeOption><chargeOptionDescription>4 Year Support, China only</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ASC         </chargeOption><chargeOptionDescription>Annual Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>MSC         </chargeOption><chargeOptionDescription>Monthly Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>DECLINESANDS</licenseType><licenseTypeDescription>Decline Subscribe and Suppt.</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ONEYRRESEL  </chargeOption><chargeOptionDescription>Reseller One Year</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption></licensedFunction><licensedFunction><licenseID>S0111R0</licenseID><description>Resource Access Control Fac</description><licenseOption><valueMetric>77D000</valueMetric><valueMetricDescription>Per Engine Registration</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>SWSUBSUPRGST</licenseType><licenseTypeDescription>SW Subs and Sup Rgst</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>CHINA4YEAR  </chargeOption><chargeOptionDescription>4 Year Support, China only</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ASC         </chargeOption><chargeOptionDescription>Annual Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>MSC         </chargeOption><chargeOptionDescription>Monthly Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>DECLINESANDS</licenseType><licenseTypeDescription>Decline Subscribe and Suppt.</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ONEYRRESEL  </chargeOption><chargeOptionDescription>Reseller One Year</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption></licensedFunction><licensedFunction><licenseID>S013T6B</licenseID><description>RSCS Feature S&amp;S</description><licenseOption><valueMetric>77D000</valueMetric><valueMetricDescription>Per Engine Registration</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>SWSUBSUPRGST</licenseType><licenseTypeDescription>SW Subs and Sup Rgst</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ASC         </chargeOption><chargeOptionDescription>Annual Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>MSC         </chargeOption><chargeOptionDescription>Monthly Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>DECLINESANDS</licenseType><licenseTypeDescription>Decline Subscribe and Suppt.</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ONEYRRESEL  </chargeOption><chargeOptionDescription>Reseller One Year</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption></licensedFunction><licensedFunction><licenseID>S0111PX</licenseID><description>z/VM Version 5</description><licenseOption><valueMetric>77D000</valueMetric><valueMetricDescription>Per Engine Registration</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>SWSUBSUPRGST</licenseType><licenseTypeDescription>SW Subs and Sup Rgst</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>CHINA4YEAR  </chargeOption><chargeOptionDescription>4 Year Support, China only</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ASC         </chargeOption><chargeOptionDescription>Annual Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>MSC         </chargeOption><chargeOptionDescription>Monthly Support Charge</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>NOCHARGE    </chargeOption><chargeOptionDescription>No Charge</chargeOptionDescription><licenseType>DECLINESANDS</licenseType><licenseTypeDescription>Decline Subscribe and Suppt.</licenseTypeDescription></licenseOption><licenseOption><valueMetric>4D9000</valueMetric><valueMetricDescription>Value Units</valueMetricDescription><chargeOption>ONEYRRESEL  </chargeOption><chargeOptionDescription>Reseller One Year</chargeOptionDescription><licenseType>SWSUBSCSUPPO</licenseType><licenseTypeDescription>SW Subscription and Support</licenseTypeDescription></licenseOption></licensedFunction></softwareoffering>

This is the output i am getting ....
 
The SAP ESW based Search results are displayed below  
Program  DescriptionCode  Description  Additional information Doc.  Type

Program DescriptionCode Description Additional information Doc. Type
5741SNS S0111R1 / 77D000 Directory Maintenance Fac Per Engine Registration CHARGE
5741SNS S0111R1 / 4D9000 Directory Maintenance Fac Value Units CHARGE
5741SNS S0111R1 / 4D9000 Directory Maintenance Fac Value Units CHARGE
5741SNS S0111R1 / 4D9000 Directory Maintenance Fac Value Units CHARGE
5741SNS S0111R1 / 4D9000 Directory Maintenance Fac Value Units CHARGE
5741SNS S0111R1 / 4D9000 Directory Maintenance Fac Value Units CHARGE
5741SNS S0111PZ / 77D000 Performance Toolkit for VM Per Engine Registration CHARGE
5741SNS S0111PZ / 4D9000 Performance Toolkit for VM Value Units CHARGE
5741SNS S0111PZ / 4D9000 Performance Toolkit for VM Value Units CHARGE
5741SNS S0111PZ / 4D9000 Performance Toolkit for VM Value Units CHARGE
5741SNS S0111PZ / 4D9000 Performance Toolkit for VM Value Units CHARGE
5741SNS S0111PZ / 4D9000 Performance Toolkit for VM Value Units CHARGE
5741SNS S0111R0 / 77D000 Resource Access Control Fac Per Engine Registration CHARGE
5741SNS S0111R0 / 4D9000 Resource Access Control Fac Value Units CHARGE
5741SNS S0111R0 / 4D9000 Resource Access Control Fac Value Units CHARGE
5741SNS S0111R0 / 4D9000 Resource Access Control Fac Value Units CHARGE
5741SNS S0111R0 / 4D9000 Resource Access Control Fac Value Units CHARGE
5741SNS S0111R0 / 4D9000 Resource Access Control Fac Value Units CHARGE
5741SNS S013T6B / 77D000 RSCS Feature S&S Per Engine Registration CHARGE
5741SNS S013T6B / 4D9000 RSCS Feature S&S Value Units CHARGE
5741SNS S013T6B / 4D9000 RSCS Feature S&S Value Units CHARGE
5741SNS S013T6B / 4D9000 RSCS Feature S&S Value Units CHARGE
5741SNS S013T6B / 4D9000 RSCS Feature S&S Value Units CHARGE
5741SNS S0111PX / 77D000 z/VM Version 5 Per Engine Registration CHARGE
5741SNS S0111PX / 4D9000 z/VM Version 5 Value Units CHARGE
5741SNS S0111PX / 4D9000 z/VM Version 5 Value Units CHARGE
5741SNS S0111PX / 4D9000 z/VM Version 5 Value Units CHARGE
5741SNS S0111PX / 4D9000 z/VM Version 5 Value Units CHARGE
5741SNS S0111PX / 4D9000 z/VM Version 5 Value Units CHARGE

OUTPUT I AM EXPECTING:::
Program Description Code Description Additional Information Doc. Type
5741SNS  S0111R1 / 77D000 Directory Maintenance Fac Per Engine Registration CHARGE
5741SNS  S0111R1 / 4D9000 Directory Maintenance Fac Value Units CHARGE
5741SNS  S0111PZ / 77D000 Performance Toolkit for VM Per Engine Registration CHARGE
5741SNS  S0111PZ / 4D9000 Performance Toolkit for VM Value Units CHARGE
5741SNS  S0111R0 / 77D000 Resource Access Control Fac Per Engine Registration CHARGE
5741SNS  S0111R0 / 4D9000 Resource Access Control Fac Value Units CHARGE
5741SNS  S013T6B / 77D000 RSCS Feature S&S Per Engine Registration CHARGE
5741SNS  S013T6B / 4D9000 RSCS Feature S&S Value Units CHARGE
5741SNS  S0111PX / 77D000 z/VM Version 5 Per Engine Registration CHARGE
5741SNS  S0111PX / 4D9000 z/VM Version 5 Value Units CHARGE


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24395279
Can you please post the file in the code snippet field, it looses some entities this way
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24395330
Output I am getting is this

It is exactly what you want.

I seem to notice that you have changed the XSLT.
I think you introduced a bug, it would be nice if you posted the new XSLT... evidently
<?xml version="1.0" encoding="utf-8"?>
<table border="1">
   <tr>
      <th>LicenseID</th>
      <th>ValueMetric</th>
      <th>ValueMetric Description</th>
   </tr>
   <tr>
      <td>S0111R1</td>
      <td>77D000</td>
      <td>Per Engine Registration</td>
   </tr>
   <tr>
      <td>S0111R1</td>
      <td>4D9000</td>
      <td>Value Units</td>
   </tr>
   <tr>
      <td>S0111PZ</td>
      <td>77D000</td>
      <td>Per Engine Registration</td>
   </tr>
   <tr>
      <td>S0111PZ</td>
      <td>4D9000</td>
      <td>Value Units</td>
   </tr>
   <tr>
      <td>S0111R0</td>
      <td>77D000</td>
      <td>Per Engine Registration</td>
   </tr>
   <tr>
      <td>S0111R0</td>
      <td>4D9000</td>
      <td>Value Units</td>
   </tr>
   <tr>
      <td>S013T6B</td>
      <td>77D000</td>
      <td>Per Engine Registration</td>
   </tr>
   <tr>
      <td>S013T6B</td>
      <td>4D9000</td>
      <td>Value Units</td>
   </tr>
   <tr>
      <td>S0111PX</td>
      <td>77D000</td>
      <td>Per Engine Registration</td>
   </tr>
   <tr>
      <td>S0111PX</td>
      <td>4D9000</td>
      <td>Value Units</td>
   </tr>
</table>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24395354
No need to post the XML again, I fixed it manually
Now I need the XSL, in order to continue
0
 

Author Comment

by:kommichowdary
ID: 24396426
Here is the XSL code...<!-- Output method -->
<xsl:key name="uniq" match="offeringInformation/softwareOffering/licensedFunction/" use="concat(../licenseID, valueMetric)"/>
      <xsl:output method="html" omit-xml-declaration="yes" indent="yes"
      <xsl:call-template name="starting">
                  <xsl:with-param name="s1" select="0" />
            </xsl:call-template>
      </xsl:template>


      <xsl:template match="offeringInformation" name="starting">
                        <head>
                  <script type="text/javascript">var v = 0;</script>

            </head>

            <table class="basic-table" cellspacing="1" cellpadding="0" width="80%" style="margin-top:2em;">
    <tr>
        <td colspan="7"></td>
    </tr>
    <tr>
   


                  <xsl:for-each
                        select="offeringInformation/softwareOffering/licensedFunction/licenseOption">                        

                        <tr>
                              <xsl:if test="(position() mod 2 = 0)">

                                    <xsl:attribute name="class">gray</xsl:attribute>
                              </xsl:if>
                              <td>
                                    <xsl:variable name="valuemetricid"

select="valueMetric">
                                    </xsl:variable>
                              
      <xsl:variable name="licenceid" select="../licenseID">
                                    </xsl:variable>
                                    
                                    <small>
                                          <a
                                                href="Softwareor.jsp?type=Licence&amp;licenceid={$licenceid}&amp;valuemetricid={$valuemetricid}">

                                                <xsl:value-of
                                                      select="../../productId/typeCode" />
                                                <xsl:value-of
                                                      select="../../productId/modelCode" />
                                          </a>
                                    </small>
                              </td>
                              <td nowrap="1">
                                    <small>
                                          <xsl:value-of select="../licenseID" />
                                          /
                                          <xsl:value-of select="valueMetric" />
                                    </small>
                              </td>
                              <td nowrap="1">
                                    <small>
                                          <xsl:value-of select="../description" />
                                    </small>
                              </td>
                              <td nowrap="1">
                                    <small>
                                          <xsl:value-of
                                                select="valueMetricDescription" />
                                    </small>
                              </td>
                              <td nowrap="1">
                                    <small>CHARGE</small>
                                    <script type="text/javascript">v++;</script>

                              </td>
                        </tr>
                        
                   </xsl:if>            
                  </xsl:for-each>
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24396527
Some comments
- if you post XML or XSL, use the code snippet pane, then the code comes out with a lot better quality
- if you post an XSLT, make sure what you post is complete
I spend too much time fixing this rubbish before I can start working on it, whilst it is only a small effort for you to copy correctly
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24396543
Too much was lost in your copying, I can't fix it in a way I can see what was wrong, please post again
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24396611
also you XML is in complete
I see this XPath
<xsl:for-each  select="offeringInformation/softwareOffering...
implying there is an offeringInformation element around what you posted
If an offeringInformation can contain multiple softwareOfferings, that could allready be the cause for duplication

How can you expect us to answer your question and help you debugging,
if you poste uncomplete data and uncomplete requirements.
This way you are wasting a lot of time from experts that could use that time to help others,
0
 

Accepted Solution

by:
kommichowdary earned 0 total points
ID: 24405856
Hello,
         In my last code snippet there were unnecessary tags  which caused the confusion ...Sorry...I have attached the correct code snippet.
Thanks
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:key name="licenseID" match="softwareOffering/licensedFunction" use="licenseID" />
<xsl:key name="valueMetric" match="softwareOffering/licensedFunction" use="valueMetric" />
<xsl:template match="softwareOffering">
<xsl:for-each select="softwareOffering/licensedFunction[count(. | key('licenseID', licenseID)[1]) = 1]">
<xsl:for-each select="licenseOption[count(. | key('valueMetric', valueMetric)[1]) = 1]">
<xsl:variable name="valuemetricid"  select="../valueMetric"> 
</xsl:variable>
<xsl:variable name="licenceid" select="../licenseID">
</xsl:variable>
<xsl:variable name="valueMetricDescription"  select="../valueMetricDescription">
</xsl:variable>
<small>
<xsl:value-of select="../licenseID" />
<xsl:value-of select="../valueMetric" />
<xsl:value-of select="../ValueMetricDescription" />
</small>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24407603
Well my friend,
what was wrong with my code?
You completely changed it, in order to have the same effect as my first example, except that it worked, and now it does not.
I started changing your example, put some effort in it and will likely end up with the same code as before.
So, can you tell me what was wrong with my example, and why you changed it, because you definitely did not improve it.
So simply tell me what functionality needs to be changed from my example, and I will help you with that, but I will not work on the code you just dumped here
0
 

Author Comment

by:kommichowdary
ID: 24409684
Sorry Buddy ..I accept your first Solution..Thanks a lot for your solution...It really helped me a lot...

Thanks...
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24409841
No problem,
please note that I am willing to help to change it to your needs if needed,
0
 

Author Comment

by:kommichowdary
ID: 24410289
Thankyou much..but i changed according to my need....

Thanks
0
 

Author Comment

by:kommichowdary
ID: 24410297
With which you gave piece of code in XML...that is really really nice...
0
 

Author Comment

by:kommichowdary
ID: 24451443
I got exact solution...what i needed ..so thanks to the expertee who provided solution..Thanks alot  Buddy :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
website file permissions 4 87
MVC and Angular 2 129
Microsoft Edge 9 109
Adding a hidden div to each row in a table 6 113
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question