XSLT not parsing correctly XML with mixed tags

SELECT from executed SQL procedure returns 3 fields into Output ContextStore defined as Datastructure on Virtual Entity. One field contains XML data. But the returned DataStructure has mixed ‘<’ , ‘>’ and &lt;, &gt; at the beginning and end of the tag - output XML example:
<request_xml>&lt;soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="27324B1C-D2AE-4B83-A023-FBCF813F5822"&gt;&lt;Trzba xmlns="http://fs.mfcr.cz/eet/schema/v3"&gt;&lt;Hlavicka dat.....
Such a XML is not correctly parsed by XSLT engine. Any idea, how to transform &lt; and &gt; to ‘<’ , ‘>’ ?

Hi Koki,

Is the <request_xml> a part of datastructure, or is it in the column?

Anyway, I think you need to use AS:ToXml()


The documentation is not yet finalized there. AS:ToXml takes one string parameter as an input (xml in string representation) and returns a nodeset (XPathNodeIterator internally)

so input parametr to get the data from SP:
<xsl:parameter name="responseFromSP"/>

<xsl:variable name="requestData" select="AS:ToXml($responseFromSP/request_xml)"/>

Or, if the column itself contains a mixed content, then we have to parse the inner xml first:

<xsl:variable name="fieldData" select="responseFromSP/ROOT/DSNname/fieldName"/>
<xsl:variable name="requestData" select="substring-before(substring-after($fieldData, '&lt;request_xml&gt;'), '&lt;/request_xml&gt;')" />

or when I am thinking more about it, maybe to call AS:ToXml() twice.
<xsl:variable name="requestData" select="AS:ToXml(AS:ToXml(fieldData)))"/>
The first one parses the input xml with <request_xml>, the second parses the inner xml.

I really need to see what is the input to the transformation exactly.