Hello experts,
Do you know what XSLT would maintain my message structure with a complete deep copy yet convert a special node of escaped xml string into normal XML format?
I have a scenario where SAP is sending an IDOC with some extra XML in a segment. This XML can vary in structure so I cannot define it inside the PI Data Type. However, PI always escapes this text. In this example file I want "myxmlnode" to be without the < ; and instead have <:
I want my XSLT mapping to run after GUI mapping to turn:
<?xml version="1.0" encoding="UTF-8"?>
<mynode1 xmlns="http://asdf"
date="2014-10-28T07:14:40">
<mynode2 blahblah="asdf2">
</mynode2>
<myxmlnode><foo xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"><foo2 comment="blah blah blah" ></foo></myxmlnode>
</mynode1>
Into:
<?xml version="1.0" encoding="UTF-8"?>
<mynode1 xmlns="http://asdf"
date="2014-10-28T07:14:40">
<mynode2 blahblah="asdf2">
</mynode2>
<myxmlnode><foo xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"><foo2 comment="blah blah blah" ></foo></myxmlnode>
</mynode1>
I'm trying with the disable-output-escaping option but something is not working right:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:copy>
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Many thanks for your advice,
Aaron