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

Re: xsl-list Digest 31 Jul 2007 05:10:00 -0000 Issue 1

Subject: Re: xsl-list Digest 31 Jul 2007 05:10:00 -0000 Issue 1213
From: David J Birnbaum <djbpitt+xml@xxxxxxxx>
Date: Tue, 31 Jul 2007 08:42:00 -0400
 Re: xsl-list Digest 31 Jul 2007 05:10:00 -0000 Issue 1
Dear XSL List,

Michael's response (and David's, earlier) clarifies that my error was not realizing that if I apply <xsl:copy-of> to an element in one namespace in my source document it must emerge in the same namespace in my result document, and setting copy-namespaces="no" cannot prevent this from happening. Using <xsl:element name="{local-name()}"> will do what I want. I think I had mistaken assumed that the name of the element was actually its local name, that the namespace part of its expanded name lived separately in a namespace node, and that by copying the element but not copying the namespace node I could create an element with just the local name.

This clarification raises a related naive question, though: What is the proper use of copy-namespaces="no"? What namespace nodes will not be copied as a result of using it, and in what sorts of situations would that be necessary or desirable?

Thanks,

David

----------------------------------------------------------------------
Date: Mon, 30 Jul 2007 09:01:01 +0100
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Subject: RE:  getting rid of namespaces
Message-ID: <006e01c7d27f$c54e21a0$6401a8c0@turtle>

If you create elements in the correct namespace, the namespace declarations
will take care of themselves. Your problem is that you want the <html>
element to be in no namespace, but you have generated it in the XHTML
namespace. This appears to be because you generated it by copying an element
from the source document. <xsl:copy-of> will always copy the expanded name
of an element unchanged from the source to the result; if you want to rename
the element you need to use <xsl:element>.

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

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.