This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Re: implements-prefix vs implements-namespace


> I don't think it says anywhere explicitly that the
> namespace prefixes on the copied namespace nodes have to stay the
> same?

Yes it does (well, implicitly, anyway).

There are two stages the prefixes could be changed: when writing namespace
nodes to the result tree, and when serializing the result tree to XML.

The rules for creating namespace nodes define how they are derived from
namespace declarations in a source document, and no licence is given to
change the names of the nodes at this stage.

At serialization time, section 16.1 [XSLT 1.0] says: "if a new tree was
[sic] constructed by parsing... the XML document... then the new tree would
be the same as the result tree, with the following possible exceptions...
May contain namespace nodes that were not present on the original."

The implication is that if you output the result tree and then parse the
result, the new tree will have a superset of the namespace nodes of the old.
"The same as" means they must have the same names.

What can change is the prefix used on element and attribute names. This is
because the XPath data model does not retain a prefix on the element or
attribute node; when a prefix is required (to evaluate the name() function
or to serialize the tree) the processor can choose any prefix provided it
maps to the correct URI. The rules at XSLT 1.1 are stricter than at XSLT
1.0, preventing the processor from inventing new prefixes unless it is
actually necessary to do so.

But it can still make an arbitrary choice if there are several prefixes
available, and this can actually happen quite easily, for example if a
namespace is the default namespace in the source document and has an
explicit prefix in the stylesheet, then it is easy to show cases where the
result document maps several prefixes to the same namespace URI.

Mike Kay


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]