Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Replacing default namespace

From: Scott Sauyet <lists@---------->
To:
Date: 7/2/2007 7:25:00 PM
Martin Honnen wrote:
Scott Sauyet wrote:



In any case, a reduced version of the input WSDL is below.  I want the 
output to be exactly the same except for the changes to the root tag:



    <definitions
        targetNamespace="http://my.new.namespace/"
        xmlns:tns="http://my.new.namespace/"

Here is an XSLT 1.0 stylesheet, I think it does what you want with Saxon 
6.5.5:

Thank you very much.  That did exactly what I was looking for.  And I 
think (or at least hope) I'm learning something from it.  I haven't used 
XSLT all that much, and when I do, I think of it as transformations of 
elements.  Other nodes have always just been modifications to those 
nodes.  You code points out what should be obvious, but which I've 
always overlooked, that my templates can match attribute nodes just as 
easily.  That makes all sorts of processing that I've previously 
struggled through much easier to accomplish.



The other thing I need to do is get Saxon into my regular routine.  When 
 I process this from Xalan (whatever version is the default when 
running Ant 1.7.0 against Java 1.6.0_01), I get a document which 
presumably has the same information, but which is cluttered up with 
additional redundant namespace declarations, one for each element in the 
original without an explicit namespace, and each one pointing to the 
WSDL namespace.  It's an annoying issue that may have hidden from me 
that several earlier attempts were actually working correctly.



Something like this:



   <ns2:message xmlns:ns2="http://schemas.xmlsoap.org/wsdl/"
                name="Sessions_OpenRequest">
      <ns3:part xmlns:ns3="http://schemas.xmlsoap.org/wsdl/"
                name="UserName" type="xs:string"/>
      <ns4:part xmlns:ns4="http://schemas.xmlsoap.org/wsdl/"
                name="Password" type="xs:string"/>
      <ns5:part xmlns:ns5="http://schemas.xmlsoap.org/wsdl/"
                name="StationName" type="xs:string"/>
   </ns2:message>

instead of:



   <message name="Sessions_OpenRequest">
      <part name="UserName" type="xs:string"/>
      <part name="Password" type="xs:string"/>
      <part name="StationName" type="xs:string"/>
   </message>

Clearly there's no real harm in Xalan's code, but damn, it's ugly!



In any case, thank you for your help.



  -- Scott


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent