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

Re: Add namespaces to a soap xml output

Subject: Re: Add namespaces to a soap xml output
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 22 Sep 2006 11:49:39 +0100
Re:  Add namespaces to a soap xml output
> I  need to add one namespaces to all node and remove all tag that not 
> contains any data from a soap envolpe request :

It seems that you don't want to add a namespace, just change the prefix
for the namespace from the default (no prefix) to cup:
Which is slightly odd as it makes no difference to any namespace aware
system which prefix is used, but anyway, something like this:


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:cup="some.url">

<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
<!--
most stuff you want to copy:
-->
<xsl:template match="*">
 <xsl:copy>
  <xsl:copy-of select="@*"/>
   <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>

<!--
stuff in cup namespace you want to prefix (why?)
-->

<xsl:template match="cup:*">
 <xsl:element name="cup:{local-name()}">
  <xsl:copy-of select="@*"/>
   <xsl:apply-templates/>
 </xsl:element>
</xsl:template>

<!--
zap empty stuff
-->

<xsl:template match="*[not(node())]" priority="2"/>

</xsl:stylesheet>



$ saxon cup.xml cup.xsl
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <cup:RICHIESTA_INFORMAZIONI_ASSISTITO xmlns:cup="some.url" DataOra="200603072355" idCup="150103" idOperatore="df">
         <cup:ASSISTITO>
            <cup:CodFiscale>CRDLCN73L04F839J</cup:CodFiscale>
         </cup:ASSISTITO>
      </cup:RICHIESTA_INFORMAZIONI_ASSISTITO>
   </soapenv:Body>
</soapenv:Envelope>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.