Re: [xsl] XSLT Hello World

Subject: Re: [xsl] XSLT Hello World
From: "Abel Braaksma (Exselt)" <abel@xxxxxxxxxx>
Date: Tue, 25 Mar 2014 19:21:28 +0100
On 25-3-2014 18:56, Wendell Piez wrote:
> Ihe,
> On Tue, Mar 25, 2014 at 1:35 PM, Ihe Onwuka <ihe.onwuka@xxxxxxxxx> wrote:
>>> Don't get me wrong: I want XML/XSLT to grow and flourish. On the other
>>> hand, I don't have to think Javascript and JSON are bad things. On the
>>> contrary, I think they help to relieve the pressure on XML/XSLT to be
>>> everything to everybody.
>> If it's a positive choice - JSON is right for my project. Fine.
>> If it's a negative choice - XML/XSLT sucks therefore I choose json...
>> then it's not a good thing.
>> Note it's not just Ja/Js. it could be Py/XML Ruby/XML. Same
>> considerations apply.
> Somehow we look at the same things, yet they (and not I) live in a
> world of suckitude. Since these people are their own worst enemies, I
> don't know what I can do to help them.

You took the words right out of my mouth ;). And surprisingly, I learned
a new word, "suckitude".

I agree, there is little you can do to help people that cross there arms
and shake their head when trying out a new language, finding out it is
not what they have been used to and dismissing it as bad because it is
different. It is a phenomenon most often seen when shifting paradigms
(imperative to functional, literate to procedural etc).

Back to topic: I have had my moment of suckitude when starting out with
XSLT, especially my struggle with xsl:variable, but thanks to this list
and to a moment of going back and learning to understand a different
viewpoint to tackle a problem, I find it now hard to live without it.

For me, I find the difference between text() and string() clear, but I
am now biased. When I explained it to my fellow non-XSLT programmers, it
took only a few minutes to explain the differences between a node test
and a function call. Luckily, they already knew the DOM, so it simply
made sense to them. If you don't, and think in opening and closing tags,
I'd understand it to be a tad harder. But frankly, I don't really see
the problem with it, yet I can understand the sentiment when being
confronted with it the first time.

There is no programming language in the world that does not have its
peculiarities, not in the least in the hello-world examples. XSLT is a
language that typically operates on XML and it is a special purpose, not
a general purpose language. A well-known close equivalent is probably
SQL. Any hello-world example in that language requires you to understand
how to create a (temporary?) table and select data from it. Not easy.
Yet SQL is embraced by many people and the same many people love and
hate it.

For any XSLT hello-world example you need to know how to create XML.
Even if you don't (in XSLT 3.0 there does not have to be a default XML
input tree anymore), you still need to write you XSLT in XML. I'm just
saying: it is not a language for a beginning programmer, at the very
least he or she needs to have a basic knowledge of XML and DOM, URIs,
Unicode and XPath.

I think therefore that any comparison with a general purpose language
makes no sense. The original example from Wendell in this thread is an
excellent starting point, but has little to do with GPL hello-world
examples. But the beauty of it is that you can immediately explain many
important concepts of the language without having written anything more
than the xsl:stylesheet root element.


Abel Braaksma
Exselt XSLT 3.0 processor

Current Thread