cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Query

Former Member
0 Kudos

Hi,

Thanks to help on here I have successfully used a combination of graphical and XSL mapping to create a soap envelope. This envelope has successfully passed into an application web service and created the expected results. Brilliant ! However, I am now processing the synchronous response from this web service and I need some help with the XSLT mapping.

The message being returned to PI is:

<?xml version="1.0" encoding="utf-8" ?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

     <ns0:PassCallToRemedyResponse xmlns:ns0="urn:CIT_Web_Calls" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <ns0:Request_ID>OLR000000000207</ns0:Request_ID>

     </ns0:PassCallToRemedyResponse>

   </soapenv:Body>

</soapenv:Envelope>

...and from this I need to generate an instance of the following known response structure within PI:

<?xml version="1.0" encoding="utf-8" ?>

<nsl:MT_RemedyRef xmlns:ns1="http://gcc.access.com/xslmapping">

    <RQSTID>OLR000000000203</RQSTID>

</nsl:MT_RemedyRef>

I am almost completely new to XSLT and only managed to get the request structure mapping thanks to some excellent examples provided by people on here.My first attempt based on what I did for the request structure was:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="urn:CIT_Web_Calls" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" version="1.0">

            <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

            <xsl:attribute-set name="attr-soap">

                        <xsl:attribute name="soap:mustUnderstand">1</xsl:attribute>

            </xsl:attribute-set>

            <xsl:template match="/ns0:PassCallToRemedyResponse">

                        <ns1:MT_RemedyRef xmlns:ns1="http://gcc.access.com/xslmapping">

                             <ns1:RQSTID>

                                   <xsl:value-of select="./Request_ID"/>

                             </ns1:RQSTID>

                        </ns1:MT_RemedyRef>

            </xsl:template>

</xsl:stylesheet>

but this only produces:

<?xml version="1.0" encoding="UTF-8"?>

  

    

        OLR000000000207

    

  

Any XSLT gurus out there who could help ?

Cheers,

PaulC.

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Please see if this helps...

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="urn:CIT_Web_Calls" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" version="1.0">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="*">

<ns1:MT_RemedyRef xmlns:ns1="http://gcc.access.com/xslmapping">

<ns1:RQSTID>

            <xsl:value-of select="ns0:PassCallToRemedyResponse/Request_ID"/>

</ns1:RQSTID>

</ns1:MT_RemedyRef>

</xsl:template>

</xsl:stylesheet>

Former Member
0 Kudos

Hi ,

A small change in xslt provided by Baskar:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:ns0="urn:CIT_Web_Calls" exclude-result-prefixes = "ns0" version="1.0">


<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="*">

<ns1:MT_RemedyRef xmlns:ns1="http://gcc.access.com/xslmapping">

<RQSTID>

            <xsl:value-of select="//ns0:PassCallToRemedyResponse/ns0:Request_ID"/>

</RQSTID>

</ns1:MT_RemedyRef>

</xsl:template>

</xsl:stylesheet>

This will exclude extra namespaces from the output.

Regards,

Beena.

Former Member
0 Kudos

Thanks for your help. XSL mapping was spot on. My synchronous scenario is now working as expected.

Cheers,

PaulC.

Answers (0)