RE: [xsl] Re: Query re XMLSpy XPath engine

Subject: RE: [xsl] Re: Query re XMLSpy XPath engine
From: "Michael Leditschke" <mike@xxxxxxxxxxx>
Date: Tue, 23 Jul 2002 12:06:54 +1000
<snip/>

> > No, not necessarily. The XPath expression does not occur in the XML
> > document being queried. Thus the namespace bindings from the source
> > document do not apply to the XPath expression. We do not know in what
> > context the XPath expression at issue does appear (an XPointer? and
> > XSLT stylesheet? a W3C XML Schema? a Schematron schema? something
> > else). Thus we do not know which namespace bindings are in scope for
> > the XPath expression. We should not assume they are the same as in
> > the
> > source document itself.
>
>
> Right. Probably Michael Leditschke can tell us in what context he's
> evaluating the expression. I don't have XMLSpy, the XPath Visualiser
> reproduces all namespace definitions from the source xml document into
> the stylesheet, which is then used to evaluate the XPath expression.
>
> Thus, XPath expressions, containing fully-qualified names with prefixes
> defined in the source document, are evaluated successfully.
>


In XMLSpy, the XPath expression is calculated in the context of the active
document, in my case the one included in the original email. There is
the option to evaluate it relative to the root or some other element. I
did it relative to the root. The evaluator does use the namespace
declarations
active at the point at which you issue the query - I have used this
previously
successfully but tried to keep the example simple for the list.

So, to answer Elliotte's question, the namespace bindings in the source
document
do appear to be used (though in my example ?incorrectly). The context is the
XPath evaluator functionality of XMLSpy being applied to the root of the
provided
source document.

I agree with Jeni that the hr element is in the http://www.w3.org/1999/xhtml
namespace because of the default namespace declaration on it.

Hence I would still argue that //html:hr should return the element whereas
//hr
should not.

For reference, here's the source document again

<root xmlns:html="http://www.w3.org/1999/xhtml";
xmlns="http://www.a.com";>
  <hr xmlns="http://www.w3.org/1999/xhtml"/>
</root>

Regards
Michael



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread