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

RE: removing namespace

Subject: RE: removing namespace
From: "Peter Ivan" <peter_ivan@xxxxxxxxxxx>
Date: Wed, 28 Dec 2005 21:24:01 +0530
remove namespace from xml
thanks mike
it solved my problem


From: "Michael Kay" <mike@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE:  removing namespace Date: Tue, 27 Dec 2005 20:53:52 -0000

You don't need to remove a namespace - you need to add one! In the input,
levering is not in a namespace, and in the output, you want it to be in the
namespace http://helloworld.com/. So you need to change the element's name.
You can't do that using xsl:copy-of, which copies elements without any
changes.

You just need a modified form of the identity template:

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

Concentrate on getting the names of the elements right, remembering that the
name has two parts, a local name and a namespace URI. The XSLT processor
will then take care of the namespace declarations and undeclarations.


Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Peter Ivan [mailto:peter_ivan@xxxxxxxxxxx]
> Sent: 27 December 2005 19:27
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  removing namespace
>
> Dear ALL
>
> I have a simple query regarding xsl namespace .
> My input xml looks like this
> <?xml version="1.0" encoding="UTF-8"?>
> <DeliveryCALetter>
> <levering>
> <soort_bestand>RNE-CADO</soort_bestand>
> <aanmaak_datum>20051221</aanmaak_datum>
> <aanmaak_tijd>123048</aanmaak_tijd>
> <raboict_ob_klant>CADO1</raboict_ob_klant>
> <batch_nummer>3</batch_nummer>
> </levering>
> </DeliveryCALetter>
> The number of elements inside levering can varry.
> My out put should look like this
>
> <?xml version="1.0" encoding="UTF-8"?>
> <DeliveryCALetter xmlns="http://helloworld.com/">
> <levering>
> <soort_bestand>RNE-CADO</soort_bestand>
> <aanmaak_datum>20051221</aanmaak_datum>
> <aanmaak_tijd>123048</aanmaak_tijd>
> <raboict_ob_klant>CADO1</raboict_ob_klant>
> <batch_nummer>3</batch_nummer>
> </levering>
> </DeliveryCALetter>
> For adding this default namespace i have made an XSL
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:template match="/">
>    <xsl:apply-templates select="DeliveryCALetter"/>
> </xsl:template>
> <xsl:template match="DeliveryCALetter">
> <DeliveryCALetter xmlns="http://helloworld.com/">
> <xsl:copy-of select="levering"/>
> </DeliveryCALetter>
> </xsl:template>
>
> But the output it gives me
> <?xml version="1.0" encoding="UTF-8"?>
> <DeliveryCALetter xmlns="http://helloworld.com/">
> <levering xmlns="">
> <soort_bestand>RNE-CADO</soort_bestand>
> <aanmaak_datum>20051221</aanmaak_datum>
> <aanmaak_tijd>123048</aanmaak_tijd>
> <raboict_ob_klant>CADO1</raboict_ob_klant>
> <batch_nummer>3</batch_nummer>
> </levering>
> </DeliveryCALetter>
>
> How can i remove xmlns="" from the tag levering.
> I tried lot of techniques but was unsuccesful.
>
> thanks and rgds
> peter
>
> _________________________________________________________________
> NRIs, paying for Money Transfers to India? Use Money2India. It's FREE
> http://creative.mediaturf.net/creatives/msn_product.htm


_________________________________________________________________
A Camera Sells every 2 Minutes on eBay. Get Your's at a Great Price Now! http://adfarm.mediaplex.com/ad/ck/4686-26272-10936-699?ck=Cameras


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.