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(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] getting rid of namespaces
Message-ID: <006e01c7d27f$c54e21a0$6401a8c0(_at_)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/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--