Re: [xsl] Parsing XPath in XSLT?

Subject: Re: [xsl] Parsing XPath in XSLT?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 31 Mar 2020 19:36:18 -0000
Dear XSL-List,

Last week readers helped me with this interesting question of parsing
a formal language (specifically XPath) in XSLT. A couple of you (John
L, Christophe) pointed me to Gunther Rademacher's awesome work on the
REx parser generator.

This is good stuff and I was indeed able to get XPath 2.0 parsing
running very readily. Fantastic!

What I haven't managed to do yet is get XPath 1.0 parsing.

For that, I need a formal grammar in EBNF that will work in Gunther's
tool. Conveniently, his other tool that draws railroad diagrams offers
one -- -- which indeed appears to be
pulled straight out of the XPath 1.0 Recommendation (see its initial
comment). Sounds good.

However, while it makes a pretty railroad diagram, this EBNF doesn't
work in REx. (There is no good reason to think, I suppose, that it
should, but it is hard not to hope. :-) Possibly it is only partial.
In any case I need either an EBNF that works, or an education, to
provide me with the skills to repair this one.

Do you have any helpful hints? What should implementers be looking at,
for formal descriptions of XPath 1.0 (assuming they want to do that
today, as I do)? In particular might there be somewhere a
complete-and-working variant of the XPath 1.0 grammar such as REx can
consume, or should it actually be pretty easy to make?

Regards, Wendell

PS - If anyone wishes to try the XPath 1.0 EBNF I have copied down
(which does not work :-):

- REx parser generator:
- non-functioning EBNF:

Maybe it is not that far off. REx chokes on the production for "Literal".
Thanks ! wap

On Thu, Mar 26, 2020 at 7:16 PM Liam R. E. Quin liam@xxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 2020-03-26 at 22:49 +0000, Christophe Marchand
> cmarchand@xxxxxxxxxx wrote:
> > I've used REx parser (exactly the URL mentioned by John) during XML
> > Prague to convert XQuery code into syntax hilighted code in slides,
> > for  a XQuery course.
> Yes - i used it in XSLT at one point for some simple XSLT coverage
> checking. (perhaps i should talk about that a bit in the course on
> analytical XSLT)
> --
> Liam Quin,
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:

...Wendell Piez... ...wendell -at- nist -dot- gov...

Current Thread