XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Posttop
Pat McDonoughSubject: Remove namespaces from SOAP payload
Author: Pat McDonough
Date: 02 Oct 2008 02:23 PM
Originally Posted: 02 Oct 2008 02:21 PM
I've created a stylesheet to strip the namespaces from the payload of a SOAP message while leaving the SOAP elements intact. Is there a better way than this?



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<xsl:template
match="*[namespace-uri() = 'http://schemas.xmlsoap.org/soap/envelope/']">
<xsl:copy>
<xsl:choose>
<xsl:when
test="translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'envelope'">
<xsl:apply-templates />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="strip" />
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>

<xsl:template match="*" mode="strip">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()" mode="strip" />
</xsl:element>
</xsl:template>

<xsl:template match="@*" mode="strip">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>

<xsl:template match="text() | processing-instruction() | comment()">
<xsl:copy />
</xsl:template>


</xsl:stylesheet>

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.