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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:53:21+00:00 2026-06-04T02:53:21+00:00

Is there a way within a single XSLT file to first open one XML

  • 0

Is there a way within a single XSLT file to first open one XML file and extract an element with children and then stuff that element into a second XML file?

If it can’t be done in one XSLT, then my choice of languages would be vb script.

I have seen many different examples here, but I am just confused and don’t understand the majority of them.

Here is the XSL i have working for extracting a node from XML1:

  <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output 
      method="xml"
      omit-xml-declaration="yes" 
      indent="yes"
      encoding="ISO-8859-1"/>
    <xsl:template match="/">
    <xsl:copy-of select="root/Collection/Item/." />
    </xsl:template> 
    </xsl:stylesheet> 

I want to take the resulting Item and append it to XML2 in the same XPATH, root/Collection.

I have a vb script from this answer How to save XML to a file (Thank you Andrew Cooper) that returns the XML to a memvar.

XML1:

<root>
 <collection1>
  <item attr1, attr2...>  ---this is what I am getting
   <more>
   </more>
  </item>
 <collection1>
 <collection2>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
 <collection2>
 ...
 <collection_n>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
 <collection_n>
</root>

XML2:

<root>
 <collection1>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
---- i want to insert node from XML1 here, only in collection1
 <collection1>
 <collection2>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
 <collection2>
 ...
 <collection_n>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
 <collection_n>
</root>

so the new XML2:

<root>
 <collection1>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
 <collection1>
 <collection2>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
 <collection2>
 ...
 <collection_n>
  <item attr1, attr2...>
   <more>
   </more>
  </item>
 <collection_n>
</root>
  • 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-04T02:53:23+00:00Added an answer on June 4, 2026 at 2:53 am

    You would use the document() function to load external documents so you can merge them with the one you’re running the transformation on. Alternatively you can supply them as node-set to a template parameter (xsl:param) if you have them as DOM trees in memory when you’re calling the XSLT.

    Look at this question that I’ve answered about a week ago. It’s exactly about how to merge content located at the same merging point (think same XPath) from multiple documents.

    Hope it helps. If it does not, please ask a more specific question about what is not clear, what have you attempted, and what isn’t working for you

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

Sidebar

Related Questions

Is there any way to have multiple distinct HTML pages contained within a single
Is there a way, in Python, to modify a single line in a file
Is there a way to create a backup of a single table within a
Is there a way within Flex Mobile 4.6 to access the main application from
Is there a way within a Flex Mobile application to listen for events with
Is there any way within the iOS SDK for an app to delete itself?
in yacc/bison grammars, is there a way from within a mid-rule action to discard
I am curious if there is a way from within a WebView when a
Is there no way to have an inline script within a Handlebars template? <script
Is there a way to password protect SAS CODE within SAS? Or, if not,

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.