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

RE: Excluding one particular attribute(namespace) when

Subject: RE: Excluding one particular attribute(namespace) when copying elements
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 31 Oct 2003 23:00:46 -0000
xslt attribute namespace
> 
> I need to copy different element to output. For all
> the elements I need to exclude the namespace attribute
> when i use "xsl:copy-of" or "xsl:copy". It seems
> difficult to specify this in XSLT. Any comment would
> be appreciated!
> 

Firstly you need to understand that namespaces are not attributes in the
XSLT data model. Namespace declarations in the serialized output are
produced as representations of the namespace nodes in the result tree. 

Secondly, copy does a copy, not a "copy everything except X". You get
more control with xsl:copy than with xsl:copy-of, but copying an element
node still copies its name unchanged and its namespace nodes unchanged.

Thirdly, you don't say you want to drop a namespace that is actually
used, or whether you want to drop it because it is unused. The two
situations are very different. If you want to drop an unused namespace,
you can do it by using <xsl:element name="local-name()"
namespace="namespace-uri()"> in place of <xsl:copy>. If you want to drop
a namespace that is in use, then what you are really doing is changing
the name of the element (or its attributes). But again, you can do this
by using <xsl:element>, this time changing the value of the namespace
attribute to select the namespace that you want the new element to be
in. If you get the names of the elements and attributes right, the
namespace declarations in the output will usually look after themselves.

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.