Hello,
I'm currently working with XSLT, although rather simplistic. I'm struggling trying to remove the encodingstyle property from a SOAP XML envelope using XSLT scripts.
This is the XML I'm working with, a simple testing envelope:
This is my desired output:
In short, stripping all SOAP elements (and the header) and 'converting' this to plain XML for further processing via more XSLT scripts.
This is the current script Im working with:
The output Im currently receiving is:
So in other words, I nearly managed to clear the encodingstyle property but the URL is still left there.
I'm thinking the quickest and easiest way to get rid of the header is by using something along the lines of copy-of select="soap:bo dy/*" so the only remaining thing is infact the body (which is perfectly fine too). However, I just cannot figure out how to rid the encodingstyle property entirely. Something such as " <xsl:template match="@encodin gstyle"/> " does not appear to have any effect whatsoever.
Does anyone have any hits/suggestions, or perhaps an alteration to my script?
Thanks in advance.
I'm currently working with XSLT, although rather simplistic. I'm struggling trying to remove the encodingstyle property from a SOAP XML envelope using XSLT scripts.
This is the XML I'm working with, a simple testing envelope:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <soapenv:envelope xmlns:urn="schemas-microsoft-com:office:spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:header/> <soapenv:body> <urn:helloworld soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <clientdata xsi:type="urn:clientdata"> <username xsi:type="xsd:string">test</username> <password xsi:type="xsd:string">test</password> </clientdata> </urn:helloworld> </soapenv:body> </soapenv:envelope>
Code:
<envelope> <body> <helloworld> <clientdata> <username>test</username> <password>test</password> </clientdata> </helloworld> </body> </envelope>
This is the current script Im working with:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="xsi">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@xsi:type"/>
<xsl:template match="@encodingstyle"/>
</xsl:stylesheet>
Code:
<envelope> <header /> <body> <helloworld>http://schemas.xmlsoap.org/soap/encoding/ <clientdata> <username>test</username> <password>test</password> </clientdata> </helloworld> </body> </envelope>
I'm thinking the quickest and easiest way to get rid of the header is by using something along the lines of copy-of select="soap:bo dy/*" so the only remaining thing is infact the body (which is perfectly fine too). However, I just cannot figure out how to rid the encodingstyle property entirely. Something such as " <xsl:template match="@encodin gstyle"/> " does not appear to have any effect whatsoever.
Does anyone have any hits/suggestions, or perhaps an alteration to my script?
Thanks in advance.
Comment