[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
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|