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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:35:18+00:00 2026-06-11T12:35:18+00:00

I have a requirement where I need to transform one XML document to another

  • 0

I have a requirement where I need to transform one XML document to another using a nodeset stored as a XSLT parameter.

Input:

<m:addCustomer xmlns:p="http://test.org"/>

Expected output format:

<m:addCustomer xmlns:p="http://test.org"/>
   <m:e1>some_value1</m:e1>
   <m:e2>some_value2</m:e2>
   <m:e3>some_value3</m:e3>
</m:addCustomer>

The issue I’m confronted with is, the only way I can pass the content of the “expected output” format, is via an XSLT parameter as follows.

<xsl:param name="testParam" xmlns:m="http://test.org">
    <m:customerData> 
         <m:e1>some_value1</m:e1>
         <m:e2>some_value2</m:e2>
         <m:e3>some_value3</m:e3>
    </m:customerData>
</xsl:param>

So far I’ve tried the following XSLT configuration without any success.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="no"/>
    <xsl:param name="testParam">
        <![CDATA[<m:customerData xmlns:m="http://cclk.lk">
    <m:e1>dfdf</m:e1>
    <m:e2>dfdf</m:e2>
    <m:e3>dfdf</m:e3></m:customer>]]>
    </xsl:param>
    <xsl:template match="/" xmlns:m="http://cclk.lk">
        <m:addCustomer>
            <xsl:value-of select="$testParam" disable-output-escaping="yes"/>
            <xsl:apply-templates select="m:customerData"/>
        </m:addCustomer>
    </xsl:template>

    <xsl:template match="m:customerData" xmlns:m="http://cclk.lk">
        <m:addUser>
            <xsl:for-each select="m:customer/*">
                <m:e1>
                    <xsl:value-of select="e1"/>
                </m:e1>
                <m:e2>
                    <xsl:value-of select="e2"/>
                </m:e2>
                <m:e3>
                    <xsl:value-of select="e3"/>
                </m:e3>
            </xsl:for-each>
        </m:addUser>
    </xsl:template>
</xsl:stylesheet>

Currently I’m unable to figure out a way to do this. Appreciate any help on this.

Regards,
Prabath

  • 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-11T12:35:19+00:00Added an answer on June 11, 2026 at 12:35 pm

    The parameter as specified:

    <xsl:param name="testParam" xmlns:m="http://test.org">
        <m:customerData> 
             <m:e1>some_value1</m:e1>
             <m:e2>some_value2</m:e2>
             <m:e3>some_value3</m:e3>
        </m:customerData>
    </xsl:param>
    

    in XSLT 1.0 creates an RTF (Result Tree Fragment) — a very restricted type, that forbids almost any meaningful XPath expression evaluation.

    The solution:

    Use the vendor-provided extension function xxx:node-set(), which converts an RTF to a regular tree.

    Do note, that this extension function name is in a vendor-defined namespace, which varies from vendor to vendor.

    There is an attempt to provide a vendor-independent implementation — the one defined in EXSLT:

    ext:node-set()

    where the prefix ext is bound to the namespace http://exslt.org/common.

    Most XSLT 1.0 processors, including the .NET XslCompiledTransform, implement ext:node-set().


    In case you don’t want any extension function, then the solution is to use the standard XSLT 1.0 function document() like this:

    document('')/*/xsl:param[@name='testParam']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the requirement to transform images attached to every document (actually need images
I have the requirement that I need to open a document in Microsoft word
I am using Asp.Net/C# in my application,I have a requirement where I need to
I have a requirement to run a transform on a xml file. it is
I have small requirement: I need add image over(up) the another image through javascript.
Hi i have a requirement i need your help for it:- I have a
I have a requirement that I need to show my records in a gridview
I have a requirement wherein I need to display on a User form, a
I have a requirement where i need to enter a text in the text
I have a requirement where I need to implement a thumbs up, thumbs down

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.