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: "steve.majewski@xxxxxxxxx" <steve.majewski@xxxxxxxxx>
Date: Sat, 8 May 2010 15:27:24 -0400
I would call this programming paradigm "pattern matching" : besides SQL, other
examples would be prolog, regular expressions in general, and especially how
they are used in languages like awk and sed: If the input matches this pattern,
apply this rule. ( Whether the rule is implemented as a function or not is secondary
to the pattern matching paradigm. ) Some AI systems mixed the pattern matching
and Object-Oriented/agent paradigms by having agents send output messages to a common
"blackboard" area which the agents also monitor for an activating/ triggering pattern.


It doesn't really map into a either a pure procedural, functional or Obj.Oriented language.

-- Steve Majewski



On May 8, 2010, at 10:24 AM, cknell@xxxxxxxxxx wrote:

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