Re: [xsl] variable outside a for-each loop: second try

Subject: Re: [xsl] variable outside a for-each loop: second try
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 21 Sep 2007 10:08:09 +0200
Mathieu Malaterre wrote:

Again thanks a lot everybody for your help. I perfectly understand that I am having a hard time moving away from procedural programming. But I still do not understand why I need to live on the edge to do something that seems pretty simple. For instance I am working on a linux debian machine. Looking for saxon in all packages:

http://packages.debian.org/search?searchon=names&keywords=saxon

The latest release is 6.5.x. Which means that most people manage
-somehow- to live with XSLT 1.x, right ?

Are there any linux/open source guy on the list. What do you use ?

Why rely on what is packaged with your system? Saxon is just a java product and requires only a JVM, which is available for every linux box. And Saxon itself is open source (so its maintainer, Michael Kay, by definition, would be a "open source guy", but I wonder if he would ever call himself that ;)


You can download it from here: http://sourceforge.net/project/showfiles.php?group_id=29872 (pick 8.9.0.4).

And yes, many people, to their own misfortune, still manage to struggle with XSLT 1.0 (there is no x, it is all 1.0).

You don't need to live on the edge. It is the other way around: you need to stop living on the edge and use the obvious. Using imperative programming where functional or declarative paradigms would be the more obvious choice, is pure masochism. Just try to select all nodes with an attribute "id" matching partial with a list of names in an online reference xml, having a deep ancestor at any level of type "P" or "DIV" and treat them differently based on the number of children it has. Oh, and don't forget to do validation on the input and output while processing.

It is about six lines in XSLT (or one, but that is cheating). I wonder how much "living on the edge" you would call that compared to how you would do the same thing in C++.

Don't get me wrong, I love C++, but languages from different paradigms just need to be treated differently. It is a mindset thing, not a "living on edge" thing. Ever tried J, K, Prolog, Haskell? Ever tried Befunge, Lisp, Fortran? It is easy to go from C++ to Java to VB to Ruby to BASICA to assembler even, but it is much harder to switch to a language with a different paradigm. To go from C to Haskell or from VB to XSLT. But once you get your mind straightened out about it, you will find that you skills in the other languages will improve and with a larger toolset, you can better choose the right tool for the right job.

Cheers,
-- Abel Braaksma

Current Thread