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

  • Home
  • SEARCH
  • 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 8880485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:10:27+00:00 2026-06-14T20:10:27+00:00

I want to append child node into parent node. Here is the XML. I

  • 0

I want to append child node into parent node.

Here is the XML. I want to append order_d into order_h if my order_no under order_h is equal to the following order_no in order_h

<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <order>
    <order_h owner="GD" order_no="421424" profoma_po="421425">
      <order_d owner="GD" item_no="100000014" line_no="1" order_no="421424" color_code="730" manufacturer="100783">

          <Size_b assoc_id="69398" row_no="0" pct_ratio="PCT" total_pct="100" priority="0" ship_pack="BULK">
            <size_d assoc_id="69398" ship_pack="BULK" ctn_sku="5602060" size_code="XS" alloc_qty="18" plan_pct_ratio="23.5" row_no="0" sort_value="5"/>
          </Size_b>
      </order_d>
    </order_h>
    <order_h owner="GD" order_no="421424" profoma_po="421425">
      <order_d owner="GD" item_no="100000014" line_no="3" order_no="421424" color_code="002" manufacturer="100783">
      </order_d>
    </order_h>
    <order_h owner="GD" order_no="421424" profoma_po="421425">
      <order_d owner="GD" item_no="100000014" line_no="2" order_no="421424" color_code="257" manufacturer="100783">
      </order_d>
    </order_h>
  </order>
  <order>
    <order_h owner="GD" order_no="421425" profoma_po="421426">
      <order_d owner="GD" item_no="100000014" line_no="1" order_no="421425" color_code="730" manufacturer="100783">

      </order_d>
    </order_h>
    <order_h owner="GD" order_no="421425" profoma_po="421426">
      <order_d owner="GD" item_no="100000014" line_no="3" order_no="421425" color_code="002" manufacturer="100783">
      </order_d>
    </order_h>
    <order_h owner="GD" order_no="421425" profoma_po="421426">
      <order_d owner="GD" item_no="100000014" line_no="2" order_no="421425" color_code="257" manufacturer="100783">
                  </order_d>
    </order_h>
  </order>
  <order>
    <order_h owner="GD" order_no="421426" profoma_po="421427">
      <order_d owner="GD" item_no="100000015" line_no="1" order_no="421426" color_code="000" manufacturer="100783">
      </order_d>
    </order_h>
    <order_h owner="GD" order_no="421426" profoma_po="421427">
      <order_d owner="GD" item_no="100000015" line_no="3" order_no="421426" color_code="002" manufacturer="100783">
         </order_d>
    </order_h>
    <order_h owner="GD" order_no="421426" profoma_po="421427">
      <order_d owner="GD" item_no="100000015" line_no="2" order_no="421426" color_code="450" manufacturer="100783">
                  </order_d>
    </order_h>
  </order>
  <order>
    <order_h owner="GD" order_no="421427" profoma_po="421428">
      <order_d owner="GD" item_no="100000015" line_no="1" order_no="421427" color_code="000" manufacturer="100783">
        </order_d>
    </order_h>
    <order_h owner="GD" order_no="421427" profoma_po="421428">
      <order_d owner="GD" item_no="100000015" line_no="3" order_no="421427" color_code="002" manufacturer="100783">
      </order_d>
    </order_h>
    <order_h owner="GD" order_no="421427" profoma_po="421428">
      <order_d owner="GD" item_no="100000015" line_no="2" order_no="421427" color_code="450" manufacturer="100783">
      </order_d>
    </order_h>
  </order>
</document>

and i need output as below

<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <order>
      <order_h owner="GD" order_no="421424" profoma_po="421425">
         <order_d owner="GD" item_no="100000014" line_no="1" order_no="421424" color_code="730" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000014" line_no="3" order_no="421424" color_code="002" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000014" line_no="2" order_no="421424" color_code="257" manufacturer="100783"/>
      </order_h>
   </order>
   <order>
      <order_h owner="GD" order_no="421425" profoma_po="421426">
         <order_d owner="GD" item_no="100000014" line_no="1" order_no="421425" color_code="730" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000014" line_no="3" order_no="421425" color_code="002" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000014" line_no="2" order_no="421425" color_code="257" manufacturer="100783"/>
      </order_h>
   </order>
   <order>
      <order_h owner="GD" order_no="421426" profoma_po="421427">
         <order_d owner="GD" item_no="100000015" line_no="1" order_no="421426" color_code="000" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000015" line_no="3" order_no="421426" color_code="002" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000015" line_no="2" order_no="421426" color_code="450" manufacturer="100783"/>
      </order_h>
   </order>
   <order>
      <order_h owner="GD" order_no="421427" profoma_po="421428">
         <order_d owner="GD" item_no="100000015" line_no="1" order_no="421427" color_code="000" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000015" line_no="3" order_no="421427" color_code="002" manufacturer="100783"/>
         <order_d owner="GD" item_no="100000015" line_no="2" order_no="421427" color_code="450" manufacturer="100783"/>
      </order_h>
   </order>
</document>

Thanks in advance

  • 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-14T20:10:29+00:00Added an answer on June 14, 2026 at 8:10 pm

    This transformation:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
     </xsl:template>
    
     <xsl:template match="order_h|order_d/node()"/>
    
     <xsl:template match="order_h[1]">
      <xsl:copy>
       <xsl:apply-templates select=
        "@*|node()|following-sibling::*/node()"/>
      </xsl:copy>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document (corrected to be made a well-formed XML document):

    <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <order>
        <order_h owner="GD" order_no="421424" profoma_po="421425">
          <order_d owner="GD" item_no="100000014" line_no="1" order_no="421424" color_code="730" manufacturer="100783">
    
              <Size_b assoc_id="69398" row_no="0" pct_ratio="PCT" total_pct="100" priority="0" ship_pack="BULK">
                <size_d assoc_id="69398" ship_pack="BULK" ctn_sku="5602060" size_code="XS" alloc_qty="18" plan_pct_ratio="23.5" row_no="0" sort_value="5"/>
              </Size_b>
          </order_d>
        </order_h>
        <order_h owner="GD" order_no="421424" profoma_po="421425">
          <order_d owner="GD" item_no="100000014" line_no="3" order_no="421424" color_code="002" manufacturer="100783">
          </order_d>
        </order_h>
        <order_h owner="GD" order_no="421424" profoma_po="421425">
          <order_d owner="GD" item_no="100000014" line_no="2" order_no="421424" color_code="257" manufacturer="100783">
          </order_d>
        </order_h>
      </order>
      <order>
        <order_h owner="GD" order_no="421425" profoma_po="421426">
          <order_d owner="GD" item_no="100000014" line_no="1" order_no="421425" color_code="730" manufacturer="100783">
    
          </order_d>
        </order_h>
        <order_h owner="GD" order_no="421425" profoma_po="421426">
          <order_d owner="GD" item_no="100000014" line_no="3" order_no="421425" color_code="002" manufacturer="100783">
          </order_d>
        </order_h>
        <order_h owner="GD" order_no="421425" profoma_po="421426">
          <order_d owner="GD" item_no="100000014" line_no="2" order_no="421425" color_code="257" manufacturer="100783">
                      </order_d>
        </order_h>
      </order>
      <order>
        <order_h owner="GD" order_no="421426" profoma_po="421427">
          <order_d owner="GD" item_no="100000015" line_no="1" order_no="421426" color_code="000" manufacturer="100783">
          </order_d>
        </order_h>
        <order_h owner="GD" order_no="421426" profoma_po="421427">
          <order_d owner="GD" item_no="100000015" line_no="3" order_no="421426" color_code="002" manufacturer="100783">
             </order_d>
        </order_h>
        <order_h owner="GD" order_no="421426" profoma_po="421427">
          <order_d owner="GD" item_no="100000015" line_no="2" order_no="421426" color_code="450" manufacturer="100783">
                      </order_d>
        </order_h>
      </order>
      <order>
        <order_h owner="GD" order_no="421427" profoma_po="421428">
          <order_d owner="GD" item_no="100000015" line_no="1" order_no="421427" color_code="000" manufacturer="100783">
            </order_d>
        </order_h>
        <order_h owner="GD" order_no="421427" profoma_po="421428">
          <order_d owner="GD" item_no="100000015" line_no="3" order_no="421427" color_code="002" manufacturer="100783">
          </order_d>
        </order_h>
        <order_h owner="GD" order_no="421427" profoma_po="421428">
          <order_d owner="GD" item_no="100000015" line_no="2" order_no="421427" color_code="450" manufacturer="100783">
          </order_d>
        </order_h>
      </order>
    </document>
    

    produces the wanted, correct result:

    <document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <order>
          <order_h owner="GD" order_no="421424" profoma_po="421425">
             <order_d owner="GD" item_no="100000014" line_no="1" order_no="421424" color_code="730" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000014" line_no="3" order_no="421424" color_code="002" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000014" line_no="2" order_no="421424" color_code="257" manufacturer="100783"/>
          </order_h>
       </order>
       <order>
          <order_h owner="GD" order_no="421425" profoma_po="421426">
             <order_d owner="GD" item_no="100000014" line_no="1" order_no="421425" color_code="730" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000014" line_no="3" order_no="421425" color_code="002" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000014" line_no="2" order_no="421425" color_code="257" manufacturer="100783"/>
          </order_h>
       </order>
       <order>
          <order_h owner="GD" order_no="421426" profoma_po="421427">
             <order_d owner="GD" item_no="100000015" line_no="1" order_no="421426" color_code="000" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000015" line_no="3" order_no="421426" color_code="002" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000015" line_no="2" order_no="421426" color_code="450" manufacturer="100783"/>
          </order_h>
       </order>
       <order>
          <order_h owner="GD" order_no="421427" profoma_po="421428">
             <order_d owner="GD" item_no="100000015" line_no="1" order_no="421427" color_code="000" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000015" line_no="3" order_no="421427" color_code="002" manufacturer="100783"/>
             <order_d owner="GD" item_no="100000015" line_no="2" order_no="421427" color_code="450" manufacturer="100783"/>
          </order_h>
       </order>
    </document>
    

    Explanation:

    Proper use of and overriding of the identity rule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I want to append the contents of a src file into the end
I jave the following mapped superclass that provides a basic implementation for a parent/child
This is driving me bonkers... I just want to add another img node. $xml
I am trying to add an XML node to multiple parent nodes(which have same
I have an xml file in which i want to read the child nodes
I have following scenario: I have a XML-Document, e.g. like this <someRootElement> <tag1> <tag2
In My App, I want to copy a node from one document to another
I want append link add in last child of class:( ('.' + change_class +
i want to append unlimited number of HTML elements with data given as comment.
I want to append .item element before .content element but it just simply removes

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.