Hi,

In DefaultNameStep.java there is the following code:

if ( myPrefix != null && myPrefix.length() > 0 )
{
    myUri = nav.translateNamespacePrefixToUri( myPrefix, node );
}

if ( myUri == null )
{
    myUri = contextSupport.translateNamespacePrefixToUri( myPrefix );
}

If I read it correctly, this code tries to resolve a prefix in name test
using the current context node. This could essentially be another one each
time; consider

<node>
  <x:foo xmlns:x="ftp://foobar.com/"/>
  <x:foo xmlns:x="http://foobar.org/"/>
  <x:foo xmlns:x="gopher://foobar.edu/"/>
</node>

and currently, the expression /node/x:foo would match all three nodes with
the local-name "foo", even if the namespace-context has been provided with
the BaseXPath.setNamespaceContext method.

In my reading of the XPath specification, this is wrong; prefixes in name
tests may only be resolved using the `expression context', which does not
contain the current node at every possible point in a location path. It
can only mean that they may only be resolved using `* the set of
namespace declarations in scope for the expression', or in other words the
namespace mappings that have been provided with the setNamespaceContext
method in BaseXPath. (This also means that you could resolve the prefix in
DefaultNameStep at parse time or only once at evaluation time)

I'm writing this now because this problem may well be compounding the
issue that Jerome Negre is having.

- Erwin



_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to