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

Re: Re: questions about XSLT philosophy: how much is t

Subject: Re: Re: questions about XSLT philosophy: how much is too much?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 21 Mar 2003 19:09:01 GMT
xsl not procedural imperative
> for someone not used to it and coming in with
> the understanding that XSLT was being promoted as a *functional*
> language, seeing it being used in what appears to be a non-functional
> (i.e., procedural) way would *seem* not natural.  that's all
> 


The term "functional" applies to the language rather than to any
particular program written in the language.
In fact unlike say some lisps or standad ML, XSLT is a rather pure
declarative language with essentially no imperative instructions.

You can fill your lisp with imperative setq statements if you wish, but
in XSLT it's just not possible to write procedural code.
In particular xsl:for-each and xsl:template both fall
very naturally in the functional paradigm, they just happen to use XML
syntax rather than f(x) syntax.
> 
> and yet, in the very next paragraph, he writes, "Instead of 
> looping, XSLT uses iteration and recursion."  excuse me but,
> where i grew up, iteration is just another word for looping.
> and looping sure seems to have a procedural programming history.

In any loop construct something needs to change otherwise you'll loop
for ever. In a C for loop or fortran DO loop etc what gets changed is
the value of some variable so the whole construct requires the
imperative/procedural notion of a variable whose value may be
changed. Loops in functional languages are different, you just
iterate some function over all the elements in some structure, and you
end when you've done them all. Just as the previous kind of loop is
syntactic shorthand for an assignment, an if test and a goto, this
kind of loop is shorthand for recursing over the structure of the
object, It is perfectly natural in a functional language.

David

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.