xsl-list
[Top] [All Lists]

RE: [xsl] Re: xsl-list Digest 31 Jul 2007 05:10:00 -0000 Issue 1213

2007-07-31 07:07:45
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?

consider

<soap:soap-envelope xmlns:soap="soap-namespace">
  <payload/>
</soap>

Doing <xsl:copy-of select="payload"/> will give you <payload
xmlns:soap="soap-namespace"/>. Using copy-namespaces="no" prevents the
namespace being copied. Copying the namespace is necessary if it's used in
the content, for example if the element is <payload
xsi:type="soap:payload"/>. The system can't tell whether the namespace is
used in the content, so it takes the safe default and assumes it is.

Usually excess namespaces do no harm, people like to get rid of them to
remove visual clutter and to reduce document sizes. Occasionally it is
necessary to remove them for other reasons, for example to make a document
DTD-valid.

Namespaces that are actually used in element and attribute names are copied
whether you like it or not.

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>
--~--

<Prev in Thread] Current Thread [Next in Thread>