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

Adding namespace to an XML through XSL

Subject: Adding namespace to an XML through XSL
From: Kanthi <kan_manikoth@xxxxxxxxx>
Date: Tue, 30 Dec 2003 08:05:46 -0800 (PST)
adding namespace xml
Hi there - 

I am having problems adding a namespace using an xsl
to an xml with no namespaces.  

My sample xml looks like this
<MainElement>
  <Element1>
   <Element2>
     <Element3> 
      :
      :
     </Element3>
   </Element2>
  </Element1>
</MainElement>

And I want to add a namespace to the <MainElement
xmlns="Something"> without any prefix.

I am doing the following in my xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="Something">
<xsl:output method="xml" version="1.0"
encoding="utf-8" indent="yes"
omit-xml-declaration="yes"/>

<xsl:template match="MainElement">
<MainElement xmlns="Something">
  <xsl:copy-of select="."/>
</MainElement>	
</xsl:template>

</xsl:stylesheet>

But the problem is that <Element1> looks like this
<Element1 xmlns="">

Any ideas on how to get round this?  I am not exactly
sure how to use "xsl:namespace-alias" for this or
whether that will help?

 
Thanks
Kanthi

__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.