[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Find the root element from an attribute node


Subject: RE: [xsl] Find the root element from an attribute node
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 11 Jul 2008 16:37:07 +0100

> OK. So none of these work - and why not? Do I really have to 
> assign a namespace? 

If your source document is in a namespace, then you must refer to its
elements by that namespace.

> 
> Is there a way to say "any namespace"? Why isn't that the default?
> 

The namespace is part of the name. Saying "any namespace" would be like
saying "anyone called Dave, don't care about the surname". That's fine so
long as your stylesheet never strays further than your own little closed
world, but if it's going to have wider exposure then you can't afford to be
so parochial.

Or to take another analogy, it's like publishing your phone number without
an international dialling code. By doing that, you are saying that you're
not expecting anyone outside your own country to want to talk to you.

What you can do in XSLT 2.0 is to say xpath-default-namespace="....". That
means that unprefixed names refer to a specific namespace, rather than to
names in no namespace.

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


Current Thread
Keywords