from tidwell's book, if i have an excerpt from an XML file:
if i want to select all nodes in a given namespace ("auth"), it
appears i can use:
Ummm... no, I believe that will select all namespace nodes named "auth" in the
document, i.e. those namespace nodes with the "auth" prefix.
There are six of them, one on each element node.
To select all nodes in the "auth" namespace, you can use
//*[namespace-uri() = 'http://whatever.auth.org']
i.e. use the namespace URI itself.
Or, declare the auth: prefix in the stylesheet and use it:
This guarantees the selected nodes are in the specified
namespace URI; it doesn't guarantee the prefix used.
By the way, there is only one element in the "auth" namespace in your
example: the <author> element. The others are in no namespace.
and while xpathtester refuses to highlight the matches, it
does at least
tell me there were 6 of them. i'm assuming that these matches are the
auth:author element itself, and the 5 children, right?
No, it matches namespace nodes; see above.
so what is the XPath expression to match, say, the
within this namespace?
But as mentioned above, there is no such node in your XML fragment.
The <last-name> element is in no namespace, unless you've declared
a default namespace somewhere.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list