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

RE: namespace prefix weirdness

Subject: RE: namespace prefix weirdness
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 17 Aug 2004 23:47:16 +0100
namespace fixup
> >           <modsCollection xmlns="http://www.loc.gov/mods/v3">
> >              <key xmlns="">test</key>
> >              <_0:mods xmlns=""
> > xmlns:_0="http://www.loc.gov/mods/v3" 
> ID="Mitchell1996b">>
> >                 <titleInfo xmlns="http://www.loc.gov/mods/v3">
> >                    <title>Introduction</title>
> >                    <subTitle>Public Space and the City</subTitle>
> >                 </titleInfo>
> 

This is certainly rather unusual output, though it's perfectly correct
according to the spec.

I think that what's happening here is that when Saxon copies an element
(xsl:copy-of applied to the mods element in this case), it first copies all
the namespace nodes from the source element, then performs namespace fixup
to decide what prefix to allocate to the element name (and to any attribute
names). While copying the namespace nodes, it has decided to generate an
xmlns="" undeclaration, because the source element does not have the
namespace xmlns="http://www.loc.gov/mods/v3" in scope and it therefore needs
to be undeclared. When it comes to generate the prefix for the mods element,
it decides that the default prefix "" is already in use, so it has to
generate an arbitrary new prefix.

In fact if Saxon delayed the decision to generate the xmlns="" undeclaration
until after namespace fixup, it could reassign the default ("") prefix, and
generate a more pleasing output tree. But it doesn't.

Michael Kay

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.