[xsl] Adding namespace to an XML through XSL

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

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

My sample xml looks like this

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"
<xsl:output method="xml" version="1.0"
encoding="utf-8" indent="yes"

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


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?


Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003

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

Current Thread