Xpath and default namespace

Dear all,

My problem is related to the fact that is seems to be impossible with 
Xpath to define a fully qualified name of an element if I have not 
defined an alias for its namespace and I suggest to add to Xpath a way 
to set the namespace of an element also if it belong to the local 
default namespace.

This fact is evidenced by the following document

<?xml version="1.0" encoding="UTF-8"?>
<a xmlns="http://www.foo.org">
<b>my first b</b>
<b xmlns="http://www.foobar.org">another namespace</b>
<b>my second b</b>
</a>

where:
//b detects:
<b>my first b</b>
<b>my second b</b>

//*[local-name()='b'] detects all the b
<b>my first b</b>
<b xmlns="http://www.foobar.org">another namespace</b>
<b>my second b</b>

//*[name()='b'] detects all the b
<b>my first b</b>
<b xmlns="http://www.foobar.org">another namespace</b>
<b>my second b</b>

How can I get only the b in the http://www.foobar.org namespace?

It should be useful to have something like:
/a/{http://www.foobar.org}:b
since the only way seems to be to have:
/a/*[name()='b' and namespace-uri()="http://www.foobar.org"]

All the best,

Fabrizio


-- 
Eng. Fabrizio Fioravanti, Ph.D.
Project Manager - Exitech
Via delle Mantellate, 16
50129 Florence - Italy
Tel/Fax:	+39055470958
Mobile:    	+393476540182
Email: 		ff@exitech.it f.fioravanti@exitech.fi.it
IM:		Skype f.fioravanti.exitech	ICQ 296-222-577
For more information on my recent publication, Skills for Managing Rapidly Changing IT Projects, please visit www.idea-group.com

Received on Tuesday, 14 March 2006 20:18:36 UTC