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

RE: Getting rid of a namespace declaration

Subject: RE: Getting rid of a namespace declaration
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 15 Mar 2004 14:15:45 -0000
xslt copy namespace declarations
# The result looks like this and I don't want those xmlns attributes ...
# 
# 
#     <div class="content" id="content">
#             <h1 xmlns="http://www.w3.org/1999/xhtml">The Census</h1>

The namespace declaration is there because namespaces used in your element
and attribute names must be declared. If you don't want the namespace
declared, don't use it in your element and attribute names.

You have generated an element whose local-name is h1 and whose namespace is
http://www.w3.org/1999/xhtml. If you don't want the namespace declaration,
then you need to generate the element so it doesn't get put in that
namespace. This means it is no longer a copy of the element in the source
document, so you can't generate it using <xsl:copy-of>. If you want to "copy
without copying namespaces", write a recursive template such as:

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

Michael Kay


 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.