Well, I apologize for being too hasty!

It appears that you guys are caught between conflicting specs, and have
chosen a solution that agrees with one of them.  The namespace spec says
that nodes with no prefix belong to the default namespace, but the xpath
spec decides to treat them as though they belong to no namespace.  What's a
poor developer to do?  The xalan team has chosen to go along with the XPath
recommendation, which clearly makes sense for a product with xpath as a key
component; if there is a better solution it's far from obvious.

But it's unfortunate for those who have to work with documents that use
default namespaces.

Jeff

----- Original Message -----
From: "Jeff Greif" <[EMAIL PROTECTED]>
To: "Joseph Kesselman" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 26, 2002 3:58 PM
Subject: Re: xpath constructor


...
> When I parse a document like this using Xerces 2.1.0 DOMParser:
... snipped...
>
> I must use paths like:
> //:verb
> /:interaction/:instructions
> from the XPathAPI in order to access the data.
> If I use paths like
> //verb
> no nodes are found.
>
> Now that I look at the xalan-j faqs, I see that perhaps this is not
supposed
> to work.  If that is true, I believe it to be a defect in the xalan xpath
> implementation, which, if conforming to the XSLT spec, should work on any
> legal namespace-aware document (in this case, the real document from which
I
> excerpted the piece above is validated to the highest extent by Xerces
> against its schema)..  It is not a reasonable solution to "Add a namespace
> declaration with a prefix...." as the FAQ suggests, since we all must
> process documents that are produced beyond our control.  Presumably it
will
> not work to transform the documents using xalan-j to add the prefix, since
> the transformation will depend on xpath and that will fail..  For a
generic
> tool like xalan-j to carve out a subset of legal and valid xml documents
on
> which to work correctly seems a mistake to me.
>
> There is a well-defined mapping at any element node of the above document
> between prefixes (including the null prefix) and namespaces, and there's
no
> good reason why xpath could not be made to use it, either using colons or
> not for the no-prefix namespace.

Reply via email to