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

Re: XML with Default Namespace

Subject: Re: XML with Default Namespace
From: "Karl Stubsjoen" <kstubs@xxxxxxxxx>
Date: Thu, 2 Aug 2007 07:57:56 -0700
Re:  XML with Default Namespace
Wow, okay this is coming together now.  I can see exactly where I was
going wrong.  I actually switched from xsl:copy-of (then not knowing
the consequences) to creating the element, had some troubles with
local-name() but realized I was landing on text nodes (thinking this
is a common mistake in identity transformations like this) so created
the text() match template.
Yes I was confusing attributes and namespace declerations in the XML.  WOOPS!
I'm really not sure why I struggled so hard with this, you see, I was
a master of:

xml/rs:data/z:row  (back in the day...)

Thanks for all the help!

Karl..

On 8/2/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> >
> > 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/

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.