xsl-list
[Top] [All Lists]

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

2010-05-08 09:24:57
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(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Costello, Roger L. <costello(_at_)mitre(_dot_)org>
Sent:     Sat, 8 May 2010 07:48:25 -0400
To:       "xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com" 
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>