RE: [xsl] In the field of programming, where does xsl:apply-templates reside?

Subject: RE: [xsl] In the field of programming, where does xsl:apply-templates reside?
From: cknell@xxxxxxxxxx
Date: Sat, 08 May 2010 10:24:29 -0400
XSLT has more in common with SQL than Java. Consider how a SQL SELECT statement would map to any Java statement. Give up? Now compare a SQL SELECT to an XSLT xsl:template.

SELECT FName, LName, MobilePhone 
FROM ContactInfo
WHERE ZipCode IN ('02853', '58741','32574');

<xsl:template match="\ContactInfo\Contact[ZipCode =('02853','58741','32574')]\Name">
    <xsl:value-of select="FName"/>
    <xsl:value-of select="LName"/>
    <xsl:value-of select="MobilePhone "/>
</xsl:template>

In both cases you will get the first and last names, and the mobile phone number of any persons in your database (xml file) whose address has a Zip Code matching one of the three listed.

Unlike Java (or C, or Basic, etc.) you tell the program what to do, not how to do it.

I know that the underlying programs that run a SQL SELECT statement and the XSLT stylesheet are written in procedural languages, but if you try to map the procedural onto the declarative, you will end up with inapt comparisons which are likely to produce either misapprehension or confusion.
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Costello, Roger L. <costello@xxxxxxxxx>
Sent:     Sat, 8 May 2010 07:48:25 -0400
To:       "xsl-list@xxxxxxxxxxxxxxxxxxxxxx" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  [xsl] In the field of programming, where does xsl:apply-templates reside?

Hi Folks,

Introductory textbooks on programming identify  constructs common among programming languages:

   - looping constructs
   - branching constructs
   - sequencing constructs

And others.

Where does xsl:apply-templates reside within the field of programming?

For example, if you were to map an XSLT program to, say, a Java program, what Java construct would you map xsl:apply-templates to?

Perhaps asking how an XSLT construct maps to a Java construct is wrong, since XSLT is a rule-based language and Java is not. Do you agree?

Perhaps a better question is, how does xsl:apply-templates map to constructs in other rule-based languages? (I confess ignorance of other rule-based languages). 

    "xsl:apply-templates falls within the general category 
     of _____________ constructs for rule-based languages." 

Would you fill in the blank please?

/Roger

Current Thread