• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

Eliminating duplicates in XML using XSlT..

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
kommichowdary
Asked:
kommichowdary
  • 10
  • 7
2 Solutions
 
Geert BormansInformation ArchitectCommented:
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
 
Geert BormansInformation ArchitectCommented:
The technique I use for unique fields is known as muenchian grouping
http://www.jenitennison.com/xslt/grouping/muenchian.html
0
 
kommichowdaryAuthor Commented:
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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Geert BormansInformation ArchitectCommented:
Can you please post the file in the code snippet field, it looses some entities this way
0
 
Geert BormansInformation ArchitectCommented:
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
 
Geert BormansInformation ArchitectCommented:
No need to post the XML again, I fixed it manually
Now I need the XSL, in order to continue
0
 
kommichowdaryAuthor Commented:
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
 
Geert BormansInformation ArchitectCommented:
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
 
Geert BormansInformation ArchitectCommented:
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
 
Geert BormansInformation ArchitectCommented:
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
 
kommichowdaryAuthor Commented:
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
 
Geert BormansInformation ArchitectCommented:
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
 
kommichowdaryAuthor Commented:
Sorry Buddy ..I accept your first Solution..Thanks a lot for your solution...It really helped me a lot...

Thanks...
0
 
Geert BormansInformation ArchitectCommented:
No problem,
please note that I am willing to help to change it to your needs if needed,
0
 
kommichowdaryAuthor Commented:
Thankyou much..but i changed according to my need....

Thanks
0
 
kommichowdaryAuthor Commented:
With which you gave piece of code in XML...that is really really nice...
0
 
kommichowdaryAuthor Commented:
I got exact solution...what i needed ..so thanks to the expertee who provided solution..Thanks alot  Buddy :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 10
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now