[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: In the field of programming, where does xsl:apply

Subject: Re: 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
Re:  In the field of programming
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: 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.