[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Replacing default namespace

Subject: Replacing default namespace
From: Scott Sauyet <lists@xxxxxxxxxx>
Date: Fri, 29 Jun 2007 13:01:25 -0400
 Replacing default namespace
I'm having a little problem transforming one WSDL file into another. I need to do some minor manipulation of a WSDL generated by one tool before I can process it with another. One of the main things I need to do is change the xmlns:tns attribute. I was naive and thought I could do it just by declaring a new one in my root tag and then mostly doing the identity transform. I'm sure some experts out there can tell me why that doesn't work, but mostly right now, I'm looking to see how to get it right.

The root <definitions> tag in the original WSDL has

xmlns:tns="http://tempuri.org/"

Now throughout the document, elements that look like these:

    <xs:simpleType name="addrFormat" .../>
    <service name="SessionsService" .../>

get transformed into these:

    <xs:simpleType xmlns:tns="http://tempuri.org/" name="addrFormat">
    <service xmlns:tns="http://tempuri.org/" name="SessionsService">

There must be some simple way to control this.

Any suggestions? The entire (short) WSDL is below.

Thanks,

-- Scott

============================================================

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="MyNewNamespace"
    xmlns:n1="http://schemas.xmlsoap.org/wsdl/"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>

<xsl:param name="bindings" select="'Service'"/>

<xsl:template match="/wsdl:definitions">
<definitions
    targetNamespace="MyNewNamespace"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="@Service@"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:ro="urn:Databox"
>
    <xsl:apply-templates/>
</definitions>
</xsl:template>

<xsl:template match="wsdl:types">
    <types>
        <xsl:apply-templates/>
    </types>
</xsl:template>

<xsl:template match="xs:schema">
    <xs:schema targetNamespace="urn:Databox" xmlns="urn:Databox">
        <xsl:text>
         </xsl:text>
        <xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/"
            schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>
    <xsl:apply-templates/>
    </xs:schema>
</xsl:template>

<xsl:template match="node() | @*">
     <xsl:copy>
          <xsl:apply-templates select="node() | @*"/>
     </xsl:copy>
</xsl:template>

</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.