on 05-01-2008 1:56 PM
I have an XSLT where I want to strip out the SOAP envelope and just have the body.I am using the following code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:test.com:xi:test" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:template match="/">
<SubmitInstallOrder xmlns:="urn:test.com:xi:test">
<InstallOrder>
<RetailerID>
<xsl:value-of select="//soap:Envelope/soap:Body/SubmitInstallOrder/InstallOrder/RetailerID"/>
</RetailerID>
</InstallOrder>
</SubmitInstallOrder>
</xsl:template>
</xsl:stylesheet>
and my input xml is the following:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<AccountInfoHeader xmlns="http://services.apple.com">
<UserName/>
<Password>2</Password>
</AccountInfoHeader>
</soap:Header>
<soap:Body>
<SubmitInstallOrder xmlns="http://services.apple.com">
<InstallOrder xmlns="">
<RetailerID>1</RetailerID>
<Fascia>2</Fascia>
<DualSiteID>3</DualSiteID>
<OrderID>4</OrderID>
<InstallAfterDate>5</InstallAfterDate>
<InstallBeforeDate>6</InstallBeforeDate>
<InstallIncludeDays>7</InstallIncludeDays>
<InstallAfterTime>8</InstallAfterTime>
<InstallBeforeTime>9</InstallBeforeTime>
<OrderType>10</OrderType>
<TerminalCD>11</TerminalCD>
<NetworkType>12</NetworkType>
<Notes>13</Notes>
</InstallOrder>
</SubmitInstallOrder>
</soap:Body>
</soap:Envelope>
My problem is the result is being produced but the field RetailerID is actually empty... so for some reason it isn't mapping...
Could someone please provide me some help.
By the way is there another function that I could use to get the entire body out without having to go through each field manually?
Hi thanks for your help..
When I try the below to just get all child elements I get the following error:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:test.com:xi:test" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:template match="/">
<SubmitInstallOrder xmlns:="urn:test.com:xi:test">
<InstallOrder>
<RetailerID>
<xsl:copy-of select="/soap:Envelope/soap:Body"/>
</RetailerID>
</InstallOrder>
</SubmitInstallOrder>
</xsl:template>
</xsl:stylesheet>
javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: com.sap.engine.lib.xml.util.NestedException: Error while sending attributes to DocHandler -> javax.xml.transform.TransformerException: Namespace fixup failed -> com.sap.engine.lib.xml.util.NestedException: Error while sending attributes to DocHandler -> javax.xml.transform.TransformerException: Namespace fixup failed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Due to the use of default namespace (xmlns="..") and empty namespace (xmlns="") in the source xml document, xpath must be tweaked a little bit to retrieve your value :
<xsl:value-of select="/soap:Envelope/soap:Body/*[name()='SubmitInstallOrder']/InstallOrder/RetailerID"/>
If you want to copy Body section and all its children, you can use this :
<xsl:copy-of select="/soap:Envelope/soap:Body"/>
Hope this helps
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please try with that
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:test.com:xi:test" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:template match="SubmitInstallOrder/InstallOrder">
<SubmitInstallOrder xmlns:="urn:test.com:xi:test">
<InstallOrder>
<RetailerID>
<xsl:value-of select="RetailerID" />
</RetailerID>
</InstallOrder>
</SubmitInstallOrder>
</xsl:template>
</xsl:stylesheet>
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.