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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:34:25+00:00 2026-06-15T21:34:25+00:00

I am trying to add a piece of an XML to an input XML

  • 0

I am trying to add a piece of an XML to an input XML using XSLT. But the output is not coming as expected. Pelase help.

My input XML :

    <input  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="nbA2.8.90.xsd">
        <nodeA id="test">
            <inodeAA> Sample </inodeAA>
            <inodeAB> Samples </inodeAB>
        </nodeA>
        <nodeB id="test">
            <inodeBA> Sample </inodeBA>
            <inodeBB> Samples </inodeBB>
        </nodeB>
    </input>

Below is another XML piece which I am passing as a parameter to me XSLT.
This piece is to be added to the input XML:

    <ns3:output xmlns:ns3="http://mysample.org">
        <ns3:reply id="rep">
            <ns3:zip>55555</ns3:zip>
            <ns3:place>SampleLoc</ns3:place>
        </ns3:reply>
    </ns3:output>

Below is my Expected Output:

    <input xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="nbA2.8.90.xsd">
        <nodeA id="test">
            <inodeAA> Sample </inodeAA>
            <inodeAB> Samples </inodeAB>
        </nodeA>
        <nodeB id="test">
            <inodeBA> Sample </inodeBA>
            <inodeBB> Samples </inodeBB>
        </nodeB>

        <ns3:output xmlns:ns3="http://mysample.org">
            <ns3:reply id="rep">
                <ns3:zip>55555</ns3:zip>
                <ns3:place>SampleLoc</ns3:place>
            </ns3:reply>
        </ns3:output>

    </input>

Below is the XSL I am using for this task:

In the below XSLT the param “outParam” holds the xml piece which I am trying to add to me input.

    <xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:ns3="http://mysample.org"
        exclude-result-prefixes="soap xsl">
        <xsl:output omit-xml-declaration="yes" indent="yes" />

        <xsl:param name="outParam"></xsl:param>

        <xsl:template match="input">
            <input>
                <xsl:copy-of copy-namespaces="no" select="./@*" />
                <xsl:copy-of copy-namespaces="no" select="node() | @*" />
            </input>
            <xsl:copy >
                <xsl:value-of select="$outParam" disable-output-escaping="yes" ></xsl:value-of>
            </xsl:copy>
        </xsl:template> 
    </xsl:stylesheet>

Below is the output I am getting. This is not matching my expected output.

    <input xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ns3="http://mysample.org"  
        xsi:noNamespaceSchemaLocation="nbA2.8.90.xsd" >
        <nodeA id="test">
            <inodeAA> Sample </inodeAA>
            <inodeAB> Samples </inodeAB>
        </nodeA>
        <nodeB id="test">
            <inodeBA> Sample </inodeBA>
            <inodeBB> Samples </inodeBB>
        </nodeB>
    </input>
    <input xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">   
        <ns3:output xmlns:ns3="http://mysample.org">
            <ns3:reply id="rep">
                <ns3:zip>55555</ns3:zip>
                <ns3:place>SampleLoc</ns3:place>
            </ns3:reply>
        </ns3:output>
    </input>

Please help. I have tried many combinations but no luck. 🙁

Note: I am performing this transformation using the Mule XSLT Transformer which transforms payload XML based on the XSLT provided.

  • 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-15T21:34:26+00:00Added an answer on June 15, 2026 at 9:34 pm

    If the parameter is a node or sequence of nodes all you need is

    <xsl:template match="input">
      <xsl:copy>
         <xsl:copy-of select="@* , node(), $outParam"/>
      </xsl:copy>
    </xsl:template>
    

    If the parameter passed in is a string with XML markup then you need

    <xsl:template match="input">
      <xsl:copy>
        <xsl:copy-of select="@*, node()"/>
        <xsl:value-of select="$outParam" disable-output-escaping="yes"/>
      </xsl:copy>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to add a class object into a List using reflection, but when invoking
I am trying to input a path using optparser in python. Unfortunately this piece
I'm trying to add a piece of text to an existing CKEditor using jQuery.
Im new to asp.net mvc. I'm trying add new model class but it got
Trying to add a blank sample app for a rails tutorial to GitHub, but
I'm using wxPython 2.8 and i'm trying to add scrollbar capabilities on the right
I am trying to add a Theme options page, and this is the piece
ím trying to add jstl/jsp component to a spring+flex+hibernate project. Im using Tomcat 5,
I'm trying to add a piece of javascript code to a certain <div> .
Issue context: Have a piece of code that's trying to add a new document

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.