RE: [xsl] Clearing up XSL-speak

Subject: RE: [xsl] Clearing up XSL-speak
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Fri, 12 Dec 2003 18:18:27 +0100
> -----Original Message-----
> From: JCS
<snip />
> I submit it's better to use select as it's what the syntax is but
> one could
> describe it as a find, or a query, that uses the syntax "select".

This one is particularly interesting... Compares better with SQL, it
definitely makes sense (to me) to draw this comparison :

<xsl:apply-templates select="foo" />


<xsl:template match="foo">
  <!-- do stuff -->

This combination means something like (drastically simplified):

SELECT f(foo) FROM sourcedoc WHERE foo=...;

Helps to explain the impossibility to create real-time loops like in
imperative programming languages. In SQL you define the main condition(s) in
the WHERE-clause. Once a record/node satisfies these criteria, it will end
up in the resultset. You can use an if(when;true;false)-expression (--or
decode(val1;val2;val1=val2;val3;val1=val3...;default) for Oracle PL/SQL) in
the SELECT to create subdivisions in the selected data, however these
expressions cannot be used to filter out any more records. It's kind of
analogous to the 'select' in xsl:apply-templates/xsl:for-each.

You _can_ use an xsl:if/xsl:choose inside a template/for-each, but if you
find yourself writing a lot of empty xsl:otherwise's, you need to consider
the possibility of filtering out the nodes beforehand, using XPath, or, if
they're not empty, just write a different template (or a different mode of
the same template).

> --
> Hating somebody is like burning down a house to get rid of a rat.
> -- unknown

A very good one, indeed! :)



 XSL-List info and archive:

Current Thread