ImperialXT
New Member
I have a requirement where I need to transform one XML document to another using a nodeset stored as a XSLT parameter. Input:\[code\]<m:addCustomer xmlns="http://test.org"/>\[/code\]Expected output format:\[code\]<m:addCustomer xmlns="http://test.org"/> <m:e1>some_value1</m:e1> <m:e2>some_value2</m:e2> <m:e3>some_value3</m:e3></m:addCustomer>\[/code\]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.\[code\]<xslaram 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></xslaram>\[/code\]So far I've tried the following XSLT configuration without any success.\[code\]<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xslutput method="xml" encoding="utf-8" indent="no"/> <xslaram 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>]]> </xslaram> <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>\[/code\]Currently I'm unable to figure out a way to do this. Appreciate any help on this.Regards,Prabath