I tried the steps given here for a variable which is containing XML itself.
I want to insert this XML into another XML.
I tried as below,
1)Passed the variable as parameter into XSLT
OutTestXML contains Test1
<Source>request</Source>
<Parameters ignoreUnresolvedVariables="false">
<Parameter name="TestXML" ref="OutTestXML"/>
</Parameters>
<ResourceURL>xsl://InsertXML.xsl</ResourceURL>
<OutputVariable>XSLTOutput</OutputVariable>
2)In XSLT gave as below,
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:param name="TestXML" select="''"/>
<xsl:template match="/">
<TestDetails>
<Id>1</Id>
<xsl:copy-of select="$TestXML"/>
</TestDetails>
</xsl:template>
</xsl:stylesheet>
3)I tried the same XSLT with even xsl:value-of
4)But in both 2nd and 3rd methods,its showing result with “ampersand lt” and “ampersand gt” replacing xml tags.
Result
(I have replaced the Ampersand symbol with word in the Result just to show how the result looks like ,because I was not able to paste the & as it was converting to < and > here.)
<?xml version="1.0" encoding="UTF-8"?><TestDetails><Id>1</Id>"ampersand lt"?xml version="1.0" encoding="UTF-8"?ampersand gt"ampersand lt"Name"ampersand gt"1"\ampersand lt"Name"ampersand gt"</TestDetails>
Please let me know how to avoid getting this “ampersand lt” and “ampersand gt” and how to get the correct XML tags <,> .
Also note that xml version is getting added in that XML variable in its previous step when I tried to do JSON to XML conversion.
So,I have to pick the node alone from the variable.Please let me know how to do this.