Re: [xsl] Rexsel — A simpler way of writing XSLT

Subject: Re: [xsl] Rexsel — A simpler way of writing XSLT
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 30 Jun 2024 22:05:54 -0000
On Sun, 2024-06-30 at 19:23 +0000, Michael Kay mike@xxxxxxxxxxxx wrote:
>
>
> My only contact with Omnimark was that (around 1997 perhaps?) it
> looked like just the thing we needed for a project, so I made
> inquiries, and they sent over a sales rep, and quoted me a price that
> was about 50% of the entire project budget (about B#250K if I
> remember). I responded saying "some mistake surely?" and they never
> got back.

We used Omnimark for some conversion projects at SoftQuad, but i think
we only needed one copy. In the world of SGML, software was expensive;
Author/Editor could run to US$1200 per seat for the editor, and
RulesBuilder (DTD compiler) was sold separately.

Part of the price difference reflects different business practices in
North America vs Europe, and part reflects the US government contractor
origins of SGML. SoftQuad did have major academic discounts, though.

There was a product i saw as a partial competitor, with a C++ based
syntax, from France, and we used that for a while (in fact had someone
on our staff who had been one of its developers) but it was not
popular. One reason i think was that it felt too much like programming
for the people attracted to SGML (and later XML) because it let people
who did not think of themselves as programmers do really advanced text
processing.

This goes back to Rexsel - i come from a world of curly braces for
grouping - C, awk, Unix shells, and so on, and a curly brace syntax
does still feel very natural to me as a result. Even though the first
systems i used did not have curly braces on their teletype keyboards!

I think the hard part of writing XSLT, once you get past either
remembering the namespaces or, more likely, copying an older stylesheet
and editing it, is not the syntax. However, therebs a spectrum. Some
people prefer

<xsl:if test="contains(., 'socks')">
  <xsl:value-of select="@colour" />
</xsl:if>

Others want to write,
<xsl:variable name="has-socks" select="contains(data(), 'socks')"/>
<xsl:if test="$has-socks = true()">
  <xsl:value-of select="@colour" />
</xsl:if>

Some want,
<xsl:value-of select="if (contains(., 'socks') then @colour else ()" />

and some prefer (in the right context)
<xsl:value-of select=".[contains(., 'socks')]/@colour" />


The flexibility is helpful because different people have different
comfort levels with different styles.

But I don't think the first one is helped especially with,

if (contains(., 'socks') {
    new text(@colour);
}

or similar. The danger is that you stop thinking about declarative
mappings and documents and start thinking about programs and being
procedural, which can only lead to a life of crime. Or something.
Right? Or that you lose your target audience, which is now the
intersection of
    people who don't think of themselves as programmers
and
    people who are comfortable with programming language syntax
which is far from an empty subset, but is smaller than if you didn't do
the intersection in the first place.

A companion question is also interesting though - how do you made an
XSLT that is useful for, and appeals to, curly-brace-programming
people? I think Rexsel moves in that direction, but to get there today
itbd use a pure JavaScript and/or CSS syntax.

liam


--
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread