Re: [xml] xpath selection of node with namespace

On Fri, Aug 24, 2001 at 02:19:13PM +1000, Keith Isdale wrote:
Hi all,

I've being tring out the example given on xmlsoft website (with the windows binaries and a
linux version built from a fairly recent cvs copy) and viewing with
xmllint using the --shell option. Even though you can select a node within
this example by matching content eg

  XPath specification was not designed to be used "standalone", but
intended for reuse by other specifications (XSLT and XPointers), 
and those provide the namespace mapping needed for the XPath engine.

  You must understand that 
 has a clear defined meaning only if the a prefix is defined. And
you can have a:b points to elements from different namespaces in a single
document, because namespaces prefixes are not defined document wide but
for a subtree.

  For the XPath query to complete you have to give a single meaning to
the prefix a . You can do that at the API level but not in the XPath
expression, check the archive I explained this already:

  The only way to make taht query without specifying the namespace
at the API level is to actually avoid using the prefix by using
the dedicated local-name and namespace-uri functions like:

   //*[ namespace-uri() = ""; and local-name() = "b" ]


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]