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: "BR Chrisman brchrisman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Jun 2022 20:26:54 -0000
I think 'jq' is an example along these lines.  It's a great little tool for
dealing with JSON and technically 'transforms' JSON, but the syntax is
quite terse, making it difficult to be very expressive in a transform.  It
also has a reduction in functionality for not having an ancestor axis and
various other pieces of the XDM as well.  It's great for what it does, but
I can't imagine it taking the shoes of xslt.
In the end, to get the clarity and functionality of xslt, I don't think the
syntax can really shrink much... particularly without losing the nice
xslt-feature of processing itself pretty well.

On Wed, Jun 29, 2022 at 8:35 AM Dimitre Novatchev dnovatchev@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Roger,
>
> Xpath already can be used as a programming language (remember our joint
> paper at Balisage-2013?).
> And it has fn:transform(), so rewriting XSLT in XPath seems redundant.
>
> I think that what XPath needs is a few additions to the XDM (such as
> having types as first-class objects of the language) and writing some
> fundamental function libraries for adding a few new fundamental data-types.
> I have been working on this and have been inspired by the current results
> and by what they show can be further achieved.
>
> I believe that by doing this XPath can be made at least as expressive and
> powerful as Python.
>
> Thanks,
> Dimitre
>
> On Wed, Jun 29, 2022 at 4:12 AM 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.
>> 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.
>>
>> 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.
>>
>> 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?
>>
>> /Roger
>>
>>
>>
>
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/965995> (by
> email <>)

Current Thread