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 6255985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:28:00+00:00 2026-05-24T14:28:00+00:00

<?xml version=1.0 encoding=windows-1250?> <CONTACTS> <CONTACT> <Customer-ID>Cus-ID3</Customer-ID> <FirstName>Arnaaud</FirstName> <LastName>Forestier</LastName> <EMail>Arnaaud_Forestier201111@yahoo.fr</EMail> </CONTACT> <CONTACT> <Customer-ID>Cus-ID5</Customer-ID> <FirstName>Arun_Forestier</FirstName> <LastName>Forestier</LastName>

  • 0
   <?xml version="1.0" encoding="windows-1250"?>
    <CONTACTS>
    <CONTACT>
    <Customer-ID>Cus-ID3</Customer-ID>
    <FirstName>Arnaaud</FirstName>
    <LastName>Forestier</LastName>
    <EMail>Arnaaud_Forestier201111@yahoo.fr</EMail>
    </CONTACT>

    <CONTACT>
    <Customer-ID>Cus-ID5</Customer-ID>
    <FirstName>Arun_Forestier</FirstName>
    <LastName>Forestier</LastName>
    <EMail>Arnaaud_Forestier201111@yahoo.fr</EMail>
    <EMail>Arnaaud_Forestier201111@gmail.com</EMail>
    </CONTACT>

    <CONTACT>
    <Customer-ID>Cus-ID7</Customer-ID>
    <FirstName>Aana</FirstName>
    <LastName>Edwards</LastName>
    <EMail>Aana.edwards@gmail.com</EMail>
    </CONTACT>

    <CONTACT>
    <Customer-ID>Cus-ID9</Customer-ID>
    <FirstName>Aana_Edwards</FirstName>
    <LastName>Edwards</LastName>
    <EMail>Aana.edwards@yahoo.com</EMail>
    </CONTACT>

     <CONTACT>
    <Customer-ID>Cus-ID11</Customer-ID>
    <FirstName>Lina</FirstName>
    <LastName>Joseph</LastName>
    <EMail>Lina.Joseph@aol.com</EMail>
    </CONTACT>

   <CONTACT>
    <Customer-ID>Cus-ID13</Customer-ID>
    <FirstName>SandfordFrankie</FirstName>
    <LastName>Frankie Sandford/LastName>
    <EMail>Sandford1233@yahoo.com</EMail>
    <URL>http://www.facebook.com/profile.php?id=122112487211054</URL>
    </CONTACT>

    <CONTACT>
    <Customer-ID>Cus-ID15</Customer-ID>
    <FirstName>Sandford</FirstName>
    <LastName>Frankie/LastName>
    <EMail>Sandford1233@yahoo.com</EMail>
    <EMail>Sandford.frankie@gmail.com</EMail>
    </CONTACT>

</CONTACTS>

The above XML file has some complex data and this question might look similar to this question.
Grouping and merging of two contacts in XSLT1.0
According to me this data is entirely different(more complex) from the above question, so i’m creating a new question here.

We see the <Customer-ID>Cus-ID3</Customer-ID> & <Customer-ID>Cus-ID5</Customer-ID> data belongs to the same person
because one of his email addess is same. How can I merge these 2 contacts as a single contact?

Another problem, <Customer-ID>Cus-ID7</Customer-ID> & <Customer-ID>Cus-ID9</Customer-ID> also belongs to another person.
Here she has two different emails but in both the contatcs, the

FirstName & LastName
are same values. How can I merge these 2 contacts as a single contact?

Would it be possible to merge these complex data?

I need an output like this using XSLT-1.0

<?xml version="1.0" encoding="windows-1250"?>
<CONTACTS>
    <CONTACT>
    <Customer-ID>Cus-ID5</Customer-ID>
        <FirstName>Arun_Forestier</FirstName>
        <LastName>Forestier</LastName>
        <EMail>Arnaaud_Forestier201111@yahoo.fr</EMail>
        <EMail>Arnaaud_Forestier201111@gmail.com</EMail>
    </CONTACT>


    <CONTACT>
    <Customer-ID>Cus-ID9</Customer-ID>
        <FirstName>Aana_Edwards</FirstName>
        <LastName>Edwards</LastName>
        <EMail>Aana.edwards@yahoo.com</EMail>
    <EMail>Aana.edwards@gmail.com</EMail>
    </CONTACT>

</CONTACTS>

Please tell me if there is any flaw in my question. Thank you very much.
Note: The email address displayed here are duplicate values.

  • 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-05-24T14:28:02+00:00Added an answer on May 24, 2026 at 2:28 pm

    As requested, here a stylesheet that works as follows:

    • merges nodes for which at least an EMail is matching
    • during merge, FirstName and SecondName are copied from the first node always
    • nodes with no matching EMail are copied as is
    • nodes without EMail nodes are copied as is

    [XSLT 1.0]

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output indent="yes"/>
    
        <xsl:key name="k_ContactsByEmail"
            match="CONTACTS/CONTACT"
            use="EMail"/>
    
        <xsl:template match="CONTACTS">
            <xsl:copy>
                <xsl:apply-templates select="CONTACT[generate-id()=
                    generate-id(key('k_ContactsByEmail',EMail)[1])]
                    |
                    CONTACT[not(EMail)]"/>
            </xsl:copy>
        </xsl:template>
    
        <xsl:template match="CONTACT">
            <xsl:copy>
                <xsl:copy-of select="*"/>
                <xsl:copy-of select="
                    key('k_ContactsByEmail', EMail)/*
                        [not(.=current()/*)]
                        [not(self::FirstName or self::LastName or self::Customer-ID)]"/>
            </xsl:copy>
        </xsl:template>
    
    </xsl:stylesheet>
    

    When applied on the XML input provided in the question, it produces:

    <CONTACTS>
       <CONTACT>
          <Customer-ID>Cus-ID3</Customer-ID>
          <FirstName>Arnaaud</FirstName>
          <LastName>Forestier</LastName>
          <EMail>Arnaaud_Forestier201111@yahoo.fr</EMail>
          <EMail>Arnaaud_Forestier201111@gmail.com</EMail>
       </CONTACT>
       <CONTACT>
          <Customer-ID>Cus-ID7</Customer-ID>
          <FirstName>Aana</FirstName>
          <LastName>Edwards</LastName>
          <EMail>Aana.edwards@gmail.com</EMail>
       </CONTACT>
       <CONTACT>
          <Customer-ID>Cus-ID9</Customer-ID>
          <FirstName>Aana_Edwards</FirstName>
          <LastName>Edwards</LastName>
          <EMail>Aana.edwards@yahoo.com</EMail>
       </CONTACT>
       <CONTACT>
          <Customer-ID>Cus-ID11</Customer-ID>
          <FirstName>Lina</FirstName>
          <LastName>Joseph</LastName>
          <EMail>Lina.Joseph@aol.com</EMail>
       </CONTACT>
       <CONTACT>
          <Customer-ID>Cus-ID13</Customer-ID>
          <FirstName>SandfordFrankie</FirstName>
          <LastName>Frankie Sandford</LastName>
          <EMail>Sandford1233@yahoo.com</EMail>
          <URL>http://www.facebook.com/profile.php?id=122112487211054</URL>
          <EMail>Sandford.frankie@gmail.com</EMail>
       </CONTACT>
    </CONTACTS>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my xml file: <?xml version=1.0 encoding=windows-1250?> <CONTACTS> <CONTACT> <FirstName>Ford</FirstName> <LastName>Pasteur</LastName> <EMail>pasteur.ford@yahoo.com</EMail> </CONTACT>
This is my original XML file: <?xml version=1.0 encoding=windows-1250?> <CONTACTS> <CONTACT> <FirstName>Arun</FirstName> <LastName>Arun_niit</LastName> <EMail>nuraaa_iceee@yahoo.co.in</EMail>
I have an XML file : <?xml version=1.0 encoding=windows-1250?> <CONTACTS> <CONTACT> <FirstName>AfgZohal</FirstName> <LastName>Zohal Afg</LastName>
This is my xml file: <?xml version=1.0 encoding=UTF-8?> <CONTACTS> <CONTACT> <FirstName>Arun</FirstName> <LastName>Arun_Neelam</LastName> <Email>nuraaa_iceee@yahoo.co.in</Email> </CONTACT>
I have an xml formatted document that looks like this: <?xml version=1.0 encoding=windows-1250?> <
I have the following xsl <?xml version=1.0 encoding=windows-1251?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:param name=currentPage>Buildings</xsl:param> <xsl:template
Here's the XML: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <feed xmlns=http://www.w3.org/2005/Atom xmlns:dc=http://purl.org/dc/elements/1.1/> <title>Rated Images</title> <link
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I am trying to parse the following XML with javascript: <?xml version='1.0' encoding='UTF-8'?> <ResultSet>
This is my xhtml code : <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC -//W3C//DTD

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.