[XML-SIG] XPathGrammar question

Martin v. Loewis martin@v.loewis.de
Fri, 21 Dec 2001 11:03:25 +0100


> So now I'm trying to use it. Late last year Martin posted an IDL
> description of a pluggable parser system, and I can also find a new
> IDL description adding some interfaces to support XSLT. Looking at the
> sources however I think the interfaces have evolved a bit since then;
> is there a more up to date IDL somewhere?

I'm only aware of a single change that I made a few days ago. Since
nobody was interested in this IDL, I lost interest as well. If you
want to use it, feel free to contribute patches. If somebody else
besides me uses it, I'm willing to stick to it even if the underlying
4XPath implementation changes.

In any case, the most recent revision of the IDL file carries the
version number 1.8.

> However, when I try to parse the expression:
> 
>   //foo
> 
> I get the following output:

Notice that this is short for

/descendant-or-self::node()/child::foo

> createAxisSpecifier 4
> createNameTest None foo
> createStep 4 (None, 'foo') []
> createAbbreviatedAbsoluteLocationPath (4, (None, 'foo'), [])
> 
> i.e. createAxisSpecifier() gets as its 'name' argument the number 4, which
> indicates the CHILD axis. // should get me the DESCENDANT_OR_SELF (6) axis
> however. 

The first step created is the child::foo step, which is then used to
create the abbreviated location path. 
createAbbreviatedAbsoluteLocationPath has only a single argument, so
I'm uncertain why you list it with four arguments.

> Placing // in the middle such as with foo//bar still seems to 
> get me child. 

Certainly, for the same reason. You should get a abbreviated relative
location step in this case, though.

> Shouldn't I be getting the same in both cases? Is this a bug or am I
> missing something?

I think you are missing something. This is difficult matter, though,
so I may as well.

Regards,
Martin