Re: [xsl] Parsing XPath in XSLT?

Subject: Re: [xsl] Parsing XPath in XSLT?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Mar 2020 20:12:59 -0000
I did such work 15 years ago, using the FXSL generic LR-1 parser (the
function func-lrParse:
https://github.com/dnovatchev/FXSL-XSLT2/blob/master/f/func-lrParse.xsl  )

One can find the modification to YACC to produce the LR-parsing tables in
XML format, at:
https://github.com/dnovatchev/FXSL-XSLT2/tree/master/Tools/YACCX

A full XPath 2.0 grammar definition in BNF, understandable by YACC, is
here:
https://github.com/dnovatchev/FXSL-XSLT2/blob/master/newWork/XPATH-Grammar.y


The LR-parsing tables for that XPath 2.0 grammar, produced by YACC are
here:
https://github.com/dnovatchev/FXSL-XSLT2/blob/master/newWork/XPATH-ParseTables.xml


And a test that parses several (randomly chosen by me at the time) XPath
2.0 expressions is here:
https://github.com/dnovatchev/FXSL-XSLT2/blob/master/newWork/XPathParse1.xsl


Cheers,
Dimitre



On Wed, Mar 25, 2020 at 10:31 AM Wendell Piez wapiez@xxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> XSL Friends,
>
> What kinds of advice can you offer on the question of parsing XPath in
> XSLT?
>
> I am currently having to interpret XPath or (more likely) an XPath
> subset into an abstract representation that can be rewritten into
> various forms. Naturally I would like to do this out of a parse tree
> or the functional equivalent, represented in some sort of XML, since
> serializing that back out is easy enough. It is producing that tree
> that is a problem. I need a parser for XPath or if not for all of
> XPath, then at least for my subset -- which includes namespaces. So
> even if partial the model must expose names and namespaces to the
> extent that a path rewriter can (for example) map into a new set of
> namespace prefixes --
>
> Any thoughts? Open source projects I should take a look at? Have the
> community-standards initiatives captured any good work in this area?
>
> Best regards,
> Wendell
>
> --
> ...Wendell Piez... ...wendell -at- nist -dot- gov...
> ...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
> ...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
> 
>


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread