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

RE: ***********Transformation of an XML document cont

Subject: RE: ***********Transformation of an XML document containing a default namespace ************
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 25 Oct 2001 10:52:47 +0100
xml unnecessary namespace
> >According to the spec, you _never_ get any control over th eprefixes
> >used, and it is perfectly OK for an XSLT serialiser to always use
> >prefixes like kmsqzzxss1: kmsqzzxss2: .... even if the
> stylesheet uses
> >fo: or whatever.  (So this is the no, it can't be done answer)
> >
> >However most (all?) systems do in fact try to preserve the namespace
> >prefixes in most situtaions.
>
> Can we not, however, assume that the processor has to preserve the
> namespace prefix regardless of what the Spec says?

Actually, the spec does require that namespace prefixes are preserved, to
some degree. Specifically, there are certain operations (such as xsl:copy,
or processing a literal result element) that cause namespace nodes to be
added to the result tree. A namespace node contains both the namespace
prefix and the URI. When serializing, every namespace node must result in a
namespace declaration that associates that prefix with that URI.

There are other operations such as <xsl:element> and <xsl:attribute> that
write a node to the result tree without creating a namespace node. In this
situation, the only requirement is that the output must assign some prefix
to the relevant namespace URI.

When the serializer outputs an element or attribute name, it can use any
prefix it likes that's assigned to the right namespace URI. In practice this
fact is only interesting in cases where the result tree has either (a) no
in-scope namespace nodes for that namespace URI or (b) several in-scope
namespace nodes for the same namespace URI. Where there is exactly one, it
will in practice choose that prefix.

The model is changed in the XSLT 1.1 WD so that the process of "namespace
fixup" happens while building the result tree rather than while serializing
it, but the effect is the same, except that the rules are tightened to
prevent the processor from inventing unnecessary namespace declarations out
of thin air: in effect, if there is exactly one namespace node for the
namespace URI, the processor is now obliged to choose that one.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.