Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8720705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:05:49+00:00 2026-06-13T07:05:49+00:00

First of i am sorry to say that removing duplicate node not working all

  • 0

First of i am sorry to say that “removing duplicate node not working all the ways as expected” even i referred multiple threads which are helped to some extend but still i have not reached to the solution what i expected.

To brief my case I want to remove XitemSup complex type element if my supplier and origin_country_id is same in following descendant.

Below is the xslt code

<xsl:stylesheet version="1.0" exclude-result-prefixes="xsl xsd ns3"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ns3="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier">
   <xsl:template match="/">
      <ns3:XItemSupDesc>
         <xsl:for-each select="//ns3:XItemSupDesc/ns3:XitemSup">             
            <xsl:if test="not(ns3:supplier=following::ns3:supplier) or not(ns3:origin_country_id=following::ns3:origin_country_id)">
                   <ns3:XitemSup>
                     <ns3:supplier>
                        <xsl:value-of select="./ns3:supplier"/>
                     </ns3:supplier>
                     <ns3:primary_supp_ind>
                        <xsl:value-of select="./ns3:primary_supp_ind"/>
                     </ns3:primary_supp_ind>
                     <ns3:origin_country_id>
                        <xsl:value-of select="./ns3:origin_country_id"/>
                     </ns3:origin_country_id>
                     <ns3:primary_country_ind>
                        <xsl:value-of select="./ns3:primary_country_ind"/>
                     </ns3:primary_country_ind>
                     <ns3:unit_cost>
                        <xsl:value-of select="./ns3:unit_cost"/>
                     </ns3:unit_cost>
                  </ns3:XitemSup>
               </xsl:if>
         </xsl:for-each>
      </ns3:XItemSupDesc>
   </xsl:template>
</xsl:stylesheet>

But if i apply on below xml it is not working

<XItemSupDesc xmlns:ns2="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier" xmlns="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier">
   <ns2:XitemSup>
      <ns2:supplier>101018</ns2:supplier>
      <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
      <ns2:origin_country_id>CA</ns2:origin_country_id>
      <ns2:primary_country_ind>N</ns2:primary_country_ind>
      <ns2:unit_cost>6</ns2:unit_cost>
   </ns2:XitemSup>
   <ns2:XitemSup>
      <ns2:supplier>102825</ns2:supplier>
      <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
      <ns2:origin_country_id>IN</ns2:origin_country_id>
      <ns2:primary_country_ind>N</ns2:primary_country_ind>
      <ns2:unit_cost>13</ns2:unit_cost>
   </ns2:XitemSup>
   <ns2:XitemSup>
      <ns2:supplier>102825</ns2:supplier>
      <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
      <ns2:origin_country_id>IN</ns2:origin_country_id>
      <ns2:primary_country_ind>N</ns2:primary_country_ind>
      <ns2:unit_cost>24</ns2:unit_cost>
   </ns2:XitemSup>
</XItemSupDesc>

I am hoping someone can let me know where I am going wrong with XSLT code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:05:50+00:00Added an answer on June 13, 2026 at 7:05 am

    I would recommend not using an xsl:for-each and just overriding the identity transform.

    XML Input

    <XItemSupDesc xmlns:ns2="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier" xmlns="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier">
        <ns2:XitemSup>
            <ns2:supplier>101018</ns2:supplier>
            <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
            <ns2:origin_country_id>CA</ns2:origin_country_id>
            <ns2:primary_country_ind>N</ns2:primary_country_ind>
            <ns2:unit_cost>6</ns2:unit_cost>
        </ns2:XitemSup>
        <ns2:XitemSup>
            <ns2:supplier>102825</ns2:supplier>
            <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
            <ns2:origin_country_id>IN</ns2:origin_country_id>
            <ns2:primary_country_ind>N</ns2:primary_country_ind>
            <ns2:unit_cost>13</ns2:unit_cost>
        </ns2:XitemSup>
        <ns2:XitemSup>
            <ns2:supplier>102825</ns2:supplier>
            <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
            <ns2:origin_country_id>IN</ns2:origin_country_id>
            <ns2:primary_country_ind>N</ns2:primary_country_ind>
            <ns2:unit_cost>24</ns2:unit_cost>
        </ns2:XitemSup>
    </XItemSupDesc>
    

    XSLT 1.0

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:ns2="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier">
        <xsl:output indent="yes"/>
        <xsl:strip-space elements="*"/>
    
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
    
        <xsl:template match="ns2:XitemSup">
            <xsl:if test="not(following::ns2:XitemSup[ns2:supplier=current()/ns2:supplier and ns2:origin_country_id=current()/ns2:origin_country_id])">
                <xsl:copy>
                    <xsl:apply-templates select="@*|node()"/>
                </xsl:copy>
            </xsl:if>       
        </xsl:template>
    
    </xsl:stylesheet>
    

    XML Output

    <XItemSupDesc xmlns="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier" xmlns:ns2="http://xmlns.oracle.com/TSS_to_RMS/RIBXItemProcess/Supplier">
       <ns2:XitemSup>
          <ns2:supplier>101018</ns2:supplier>
          <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
          <ns2:origin_country_id>CA</ns2:origin_country_id>
          <ns2:primary_country_ind>N</ns2:primary_country_ind>
          <ns2:unit_cost>6</ns2:unit_cost>
       </ns2:XitemSup>
       <ns2:XitemSup>
          <ns2:supplier>102825</ns2:supplier>
          <ns2:primary_supp_ind>N</ns2:primary_supp_ind>
          <ns2:origin_country_id>IN</ns2:origin_country_id>
          <ns2:primary_country_ind>N</ns2:primary_country_ind>
          <ns2:unit_cost>24</ns2:unit_cost>
       </ns2:XitemSup>
    </XItemSupDesc>
    

    Note: If you could use XSLT 2.0, you could get rid of the xsl:if and change the template to:

    <xsl:template match="ns2:XitemSup[following::ns2:XitemSup[ns2:supplier=current()/ns2:supplier and ns2:origin_country_id=current()/ns2:origin_country_id]]"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I need to say that my English is not good. So
first of all sorry for my English :-) not so good. I have a
First of all I just want to say that I never understood so well
Note first of all that this question is not tagged winforms or wpf or
First of all, I want to say sorry for this very big question, but
First of all Sorry for my English. Let say I have, 0 // 0
First of all, I would like to say that I'm just beginning learning objective-c.
first of all i m sorry for my bad english becouse i m not
First of all sorry if it's a dumb question (and surely it is), but
First of all sorry for the name of the title, but i dont know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.