...
Extraction of XML document packed in a field of other XML
descIf one the fields of the XML, for example <FieldWithData> contains in itself other XML as escaped text:
Code Block | |
---|---|
Code Block | |
| |
source |
Substitution of current date in the test message
desc
| |
<Data>
<FieldWithData><f1 a1="a1_val"><f2>val2</f2><f3>val3</f3></f1></FieldWithData>
</Data> |
you can extract it using below XSLT before IFTT XML comparison:
Code Block | ||
---|---|---|
| ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="FieldWithData/text()">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:template>
</xsl:stylesheet> |
Using this technique will allow you to compare content of <FieldWithData> as XML not as a one long value of a single field.
XSLT for other encodings than UTF-8
desc
...
In case your XML is encoded not in UTF-8 and you are missing some characters during output comparison in IFTT, you can use below simple XSLT that will remove encoding and allow XSLT engine to convert message to UTF-8. This is implicit XSLT engine conversion.
Code Block | ||
---|---|---|
| ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet> |