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

Re: Functional Programming: How do I convert an xsl:f

Subject: Re: Functional Programming: How do I convert an xsl:for-each loop into a functional style?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 21 Jan 2010 19:52:23 +0000
Re:  Functional Programming: How do I convert an  xsl:f
On 21/01/2010 19:33, Costello, Roger L. wrote:
Hi Folks,

Would you please give me an example of an XSLT transform that is not written in a functional style?

anything using saxon:assign


And then would you show an equivalent XSLT transform, but written in a functional style?

replace the assignment by something else, eg parameter passing.

I presume that it is better to write XSLT transforms in a functional style, yes?
Only in so far as it is usually better to use the idioms for which a language was designed. If you try to write your Java like fortran, it's painful and you're better off writing in Fortran but the converse is also true: if you are programming in a java style you may find java more natural than fortran.



XSLT has (some) aspects of a functional language although it lacks what is usually thought of as the definining characteristic of such a language that functions can be passed as values. Of course Dimitre's FXSL goes a long way to filling that gap by using element nodes as proxies for function terms, and the long awaited xpath 2.1 promises to go further with higher order function terms.


David

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.