Re: [xsl] Expand XPath with a few abstractions and use it as a standalone language ... run expanded-XPath through a preprocessor to generate equivalent XSLT/XPath

Subject: Re: [xsl] Expand XPath with a few abstractions and use it as a standalone language ... run expanded-XPath through a preprocessor to generate equivalent XSLT/XPath
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Jun 2022 21:03:03 -0000
On Wed, 29 Jun 2022 at 12:12, Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> Recently I was reading about Ratfor (Rational Fortran). Ratfor is a layer
> on top of Fortran.
>
> Fortran does not provide nice control structures such as the while-loop.


Not that it really changes your point but it is 2022 and Fortran has had
while loops since Fortran 90 (so 1992 or so)
http://www.personal.psu.edu/jhm/f90/statements/do_w.html




> Instead, you have to use labels and gotos. The resulting (spaghetti-like)
> program imposes a large cognitive load on the developer and maintainer.
> Writing Fortran programs is unreasonably difficult and error prone.
>

Hmm we have a lot more Fortran than XSLT (although quite a lot of the
Fortran is written by XSLT:-)

>
> So some clever fellow created Ratfor, which provides abstractions such as
> the while loop. The abstractions make it much easier to write and maintain
> programs. A preprocessor converts the Ratfor into equivalent Fortran. For
> example, the preprocessor converts the while-loop into equivalent labels
> and gotos.
>
> I really like XSLT. In my experience, however, the verbosity of its XML
> syntax imposes a substantial cognitive load on the developer and
> maintainer. This makes implementing large and/or complex programs
> unreasonably difficult and error prone.
>
> In my opinion, XPath, with its concise notation would be a superior
> language for programming large and/or complex programs. If XPath were
> enhanced with a few things, such as apply-templates (as was discussed a
> couple weeks ago), it would make for a programming language that is easier
> to write and maintain programs.
>

that in a nutshell is xquery: xpath extended with some xslt features such
as function definitions and loops, but with a uified syntax not the "wo
languag" modl of xpath-in-xslt


> In the spirit of Ratfor, it seems that it should be possible to write a
> preprocessor that converts "expanded-XPath" into equivalent XSLT/XPath. Has
> anyone done this -- created an expanded-XPath and a preprocessor which
> converts expanded-XPath into equivalent XSLT/XPath?
>


You may find my xq2xml project if you search around, that did exactly that
and re-wrote xquery (v1)  to xslt/xpath (v2)

 David


> /Roger

Current Thread