xsl-list
[Top] [All Lists]

Re: how to select elements in a given namespace?

2003-03-17 14:02:33
Hi Robert,

That will select all the *namespace*nodes* named "auth". Namespace
nodes are nodes that represent a prefix-namespace binding. Such a
namespace node will exist on every element within the scope of the
xmlns:auth="..." namespace declaration.

ah, right, so there will be a "child" namespace node for each
element within the scope of the declaration. this would represent
the parent <auth:author xmlns:auth=...> element itself and its five
children, correct?

That's right.

If you want to select all the elements in the namespace associated
with the prefix 'auth', use:

  //auth:*

All attributes in that namespace with:

  //@auth:*

Note that the 'auth' namespace must be declared in the stylesheet
(or in whatever context you're selecting the nodes). A stylesheet will
not automatically pick up on the fact that the namespace is declared
in the XML document.

in fact, those were two of the first things i tried. both of the
above generate "ERROR: Prefix auth has not been declared". and since
i'm using xpathtester, it can't be a stylesheet issue. so i'm still
a bit confused

It sounds to me as if you haven't declared the 'auth' prefix within
xpathtester. I don't know the tool, but there should be a way for you
to set up the namespaces and associated prefixes that you want to use
in your XPath so that you can then use those prefixes in the paths
that you want to test.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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