Hi,
I tried to create XSLT that converts XML into TXT, it works ok in Developer Studio, but after deploy into IFS Cloud 22R1 app, it does not work as expected.
All new lines was removed.
I tried multiple solutions, all failed.
Is here some recommended way how to achieve this via XSL? Or it is BUG? Or TXT output is not allowed in IFS for some reason?
Source XML:
<?xml version="1.0" encoding="UTF-8"?>
<gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
<gesmes:subject>Reference rates</gesmes:subject>
<gesmes:Sender>
<gesmes:name>European Central Bank</gesmes:name>
</gesmes:Sender>
<Cube>
<Cube time='2022-05-11'>
<Cube currency='USD' rate='1.0553'/>
<Cube currency='JPY' rate='137.07'/>
<Cube currency='BGN' rate='1.9558'/>
<Cube currency='CZK' rate='25.365'/>
<Cube currency='DKK' rate='7.4393'/>
<Cube currency='GBP' rate='0.85393'/>
<Cube currency='HUF' rate='379.13'/>
<Cube currency='PLN' rate='4.6575'/>
<Cube currency='RON' rate='4.9470'/>
<Cube currency='SEK' rate='10.5260'/>
<Cube currency='CHF' rate='1.0446'/>
<Cube currency='ISK' rate='139.30'/>
<Cube currency='NOK' rate='10.1793'/>
<Cube currency='HRK' rate='7.5365'/>
<Cube currency='TRY' rate='16.1851'/>
<Cube currency='AUD' rate='1.5055'/>
<Cube currency='BRL' rate='5.3859'/>
<Cube currency='CAD' rate='1.3685'/>
<Cube currency='CNY' rate='7.0893'/>
<Cube currency='HKD' rate='8.2839'/>
<Cube currency='IDR' rate='15308.87'/>
<Cube currency='ILS' rate='3.6148'/>
<Cube currency='INR' rate='81.4935'/>
<Cube currency='KRW' rate='1343.99'/>
<Cube currency='MXN' rate='21.3870'/>
<Cube currency='MYR' rate='4.6185'/>
<Cube currency='NZD' rate='1.6645'/>
<Cube currency='PHP' rate='54.992'/>
<Cube currency='SGD' rate='1.4622'/>
<Cube currency='THB' rate='36.492'/>
<Cube currency='ZAR' rate='16.9275'/>
</Cube>
</Cube>
</gesmes:Envelope>
XSLT 1):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns:a="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
<xsl:output method="text" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="/gesmes:Envelope/a:Cube/a:Cube" />
</xsl:template>
<xsl:template match="/gesmes:Envelope/a:Cube/a:Cube">
<xsl:variable name="date" select="@time" />
<xsl:for-each select="a:Cube">
<xsl:value-of select="concat(@currency, ';', @rate, ';', $date, '
')" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Result in Developer Studio (and wanted result):
USD;1.0553;2022-05-11
JPY;137.07;2022-05-11
BGN;1.9558;2022-05-11
CZK;25.365;2022-05-11
DKK;7.4393;2022-05-11
GBP;0.85393;2022-05-11
HUF;379.13;2022-05-11
PLN;4.6575;2022-05-11
RON;4.9470;2022-05-11
SEK;10.5260;2022-05-11
CHF;1.0446;2022-05-11
ISK;139.30;2022-05-11
NOK;10.1793;2022-05-11
HRK;7.5365;2022-05-11
TRY;16.1851;2022-05-11
AUD;1.5055;2022-05-11
BRL;5.3859;2022-05-11
CAD;1.3685;2022-05-11
CNY;7.0893;2022-05-11
HKD;8.2839;2022-05-11
IDR;15308.87;2022-05-11
ILS;3.6148;2022-05-11
INR;81.4935;2022-05-11
KRW;1343.99;2022-05-11
MXN;21.3870;2022-05-11
MYR;4.6185;2022-05-11
NZD;1.6645;2022-05-11
PHP;54.992;2022-05-11
SGD;1.4622;2022-05-11
THB;36.492;2022-05-11
ZAR;16.9275;2022-05-11
Result in IFS Cloud 22R1:
XSLT 2):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns:a="http://www.ecb.int/vocabulary/2002-08-01/eurofxref" xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output encoding="utf-8" method="text" indent="no" omit-xml-declaration="yes" xml:space="default" xalan:line-separator="
"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:apply-templates select="/gesmes:Envelope/a:Cube/a:Cube"/>
</xsl:template>
<xsl:template match="/gesmes:Envelope/a:Cube/a:Cube">
<xsl:variable name="date" select="@time"/>
<xsl:for-each select="a:Cube">
<xsl:value-of select="concat(@currency, ';', @rate, ';', $date)"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
XSLT 3):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns:a="http://www.ecb.int/vocabulary/2002-08-01/eurofxref" xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output encoding="utf-8" method="text" indent="no" omit-xml-declaration="yes" xml:space="default" xalan:line-separator="
"/>
<xsl:template match="/">
<xsl:apply-templates select="/gesmes:Envelope/a:Cube/a:Cube"/>
</xsl:template>
<xsl:template match="/gesmes:Envelope/a:Cube/a:Cube">
<xsl:variable name="date" select="@time"/>
<xsl:for-each select="a:Cube">
<xsl:value-of select="concat(@currency, ';', @rate, ';', $date)"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks
BR