Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] XML with Default Namespace

From: "Michael Kay" <mike@------------>
To:
Date: 8/2/2007 8:25:00 AM
> Ok, some progress, but I can't seem to get rid of the 
> attribute, xmlns:o.

First, don't think of it as an attribute. It looks like an attribute in
lexical XML, but XSLT doesn't see it that way. It's there because an element
in your tree has a namespace node that binds the prefix o to the namespace
urn:schemas-microsoft-com:office:office.

There are four ways a namespace can find its way into your result document,
and the way you prevent it depends on how it got there.

(a) If you use a literal result element in the stylesheet then all
namespaces declared in the stylesheet that are in scope for that element are
copied to the result document. You can prevent this using
exclude-result-prefixes.

(b) If you use xsl:copy or xsl:copy-of to copy an element from the source
document, then all its in-scope namespaces are copied from the source
document. You can prevent this in XSLT 2.0 using copy-namespaces="no". In
1.0 the only remedy is to switch to using xsl:element.

(c) If you create an element or attribute in the result tree, by any means,
and the element or attribute name is in a namespace, then a namespace
binding will automatically be created to ensure that this namespace is
properly declared. There is no way of preventing this, because the document
would be ill-formed if the namespace were not declared.

(d) (Rare) You can also explicitly create or copy a namespace node using
xsl:copy[-of] applied to a namespace node in the source document, or (in
XSLT 2.0) xsl:namespace. If you don't want the namespace then remove the
instruction that creates it...

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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent