AKDeveloper
AKDeveloper

Reputation: 1

XSLT in API connect version 10 Reserved instance

I am new to API connect development, trying to code a XSLT in API connect reserved instance version 10. I have sample input and XSLT, but getting error while doing the same.

Request: Below is the sample SOAP request used as input.

    <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
     <soap-env:Header/>
       <soap-env:Body>
        <n0:Z_V_PGIResponse xmlns:n0="urn:sap-com:document:sap:rfc:functions">
            <RETURN>
                <item>
                    <PGIDAT>1</PGIDAT>
                    <MESSAGE>Delivery not found.</MESSAGE>
                </item>
                <item>
                    <PGIDAT>2</PGIDAT>
                    <MESSAGE>Delivery not found-2.</MESSAGE>
                </item>
            </RETURN>
        </n0:Z_V_PGIResponse>
    </soap-env:Body>
</soap-env:Envelope>

XSLT code: Below is the XSLT used in which I tried APIM and APIGW fucntions to use in v10 RI

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:func="http://exslt.org/functions" xmlns:n0="urn:sap-com:document:sap:rfc:functions" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apimgw="http://www.ibm.com/apimanagement" extension-element-prefixes="dp func apim">
    <!-- Contains the APIM functions -->
    <xsl:import href="local:///isp/policy/apimgw.custom.xsl"/>
    <xsl:include href="store:///dp/apigw.custom.xsl"/>
    <xsl:template match="/">
        <!--<xsl:variable name="input" select="apim:payloadRead()"/>-->
        <xsl:variable name="currentPayload" select="apigw:read-payload('message')" />
        <RETURN>
            <xsl:for-each select="$currentPayload/soap-env:Envelope/soap-env:Body/n0:Z_V_PGIResponse/RETURN/item">
                <PGIDATE>
                    <xsl:value-of select="PGIDAT"/>
                </PGIDATE>
                <MESSAGE>
                    <xsl:value-of select="MESSAGE"/>
                </MESSAGE>
            </xsl:for-each>
        </RETURN>
</xsl:stylesheet>

Error-

"errName": "TransformError",

"errMsg": "Failed to execute a stylesheet"

I had gone through couple of IBM documentation but not getting desired output, which is bit confusing as the one counters the other.

Upvotes: 0

Views: 628

Answers (1)

hpernaa
hpernaa

Reputation: 31

if that example stylesheet is a complete one, you are missing a closing tag for template.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions"
xmlns:func="http://exslt.org/functions"
xmlns:n0="urn:sap-com:document:sap:rfc:functions"
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:apimgw="http://www.ibm.com/apimanagement"
extension-element-prefixes="dp func apim">
<!-- Contains the APIM functions -->
<xsl:import href="local:///isp/policy/apimgw.custom.xsl" />
<xsl:include href="store:///dp/apigw.custom.xsl" />
<xsl:template match="/">
    <!--<xsl:variable name="input" select="apim:payloadRead()"/> -->
    <xsl:variable name="currentPayload"
        select="apigw:read-payload('message')" />
    <RETURN>
        <xsl:for-each
            select="$currentPayload/soap-env:Envelope/soap-env:Body/n0:Z_V_PGIResponse/RETURN/item">
            <PGIDATE>
                <xsl:value-of select="PGIDAT" />
            </PGIDATE>
            <MESSAGE>
                <xsl:value-of select="MESSAGE" />
            </MESSAGE>
        </xsl:for-each>
     </RETURN>
   </xsl:template>
 </xsl:stylesheet>

--HP

Upvotes: 2

Related Questions