on 11-18-2022 1:11 PM
Hello,
I am new to XSLT mapping in SAP CPI and need your help. I have XML input in the format shown below and want output also to be in same XML format only.The only condition is to replace special characters(HTML encoded) like & to & in Value tag.I tried the below XSLT mapping, but it is not working, and the output is no longer in XML format. Can anyone please help?
Input XML:-
XSLT Mapping code:-
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:epcis="urn:epcglobal:epcis:xsd:1" xmlns:sbdh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" xmlns:sap="http://sap.com/xi/STTP/SAPExt" xmlns:cbvmda="urn:epcglobal:cbv:mda" xmlns:gs1ushc="http://epcis.gs1us.org/hc/ns" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:custom="http://localhost:8080/customFunctions" xmlns:tl="http://epcis.tracelink.com/ns" exclude-result-prefixes="custom gs1ushc xs xsi">
<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:template>
<!--<xsl:template match="/entry/properties/Id[contains(text(),'ENDPOINT')]">-->
<xsl:template match="/entry">
<xsl:for-each select="/properties">
<xsl:value-of select="Value" disable-output-escaping="yes"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<br>
Output:-
Thanks in advance!
Regards,
Krishma
Hello Krishma,
Below might help you.
Input XML:
<root>
<record>
<Field1>123</Field1>
<Field2>ew3</Field2>
<Field3>https://www.sap.com/∫erface=sisisi</Field3>
</record>
<record>
<Field1>122</Field1>
<Field2>ew1</Field2>
<Field3>https://www.sap.com/∫erface=sisisi1</Field3>
</record>
</root><br>
XSLT:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/root/record">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:template>
</xsl:transform><br>
Output XML:
<root>
<record>
<Field1>123</Field1>
<Field2>ew3</Field2>
<Field3>https://www.sap.com/∫erface=sisisi</Field3>
</record>
<record>
<Field1>122</Field1>
<Field2>ew1</Field2>
<Field3>https://www.sap.com/∫erface=sisisi1</Field3>
</record>
</root><strong><br></strong>
Also whenever you post question please try to add XML message instead of screenshot that would help to provde aswers quickly.
Regards,
Sriprasad Shivaram Bhat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.