Subject: Re: [xsl] xslt style From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Fri, 10 Jan 2003 03:27:48 -0800 (PST) |
> > But to answer your more general question, you're correct that in > > unextended XSLT 1.0 you have to call templates to perform functions > > and that sometimes this can lead to verbose and ungainly code. > > However, most XSLT processors have a mechanism for defining > > extension functions. Several support EXSLT's > > func:function/func:result elements, > > which enable you to do: > > Correct me if I'm wrong, or restarting an ancient debate, but it > strikes me that using XSLT in this way is basically "Wrong" or a Bad > Thing. I've found that usually there is a fairly simple way to avoid > procedural techniques if I conceptualize the program as being the XML > data, and think of it as the data making calls on the XSLT. Using an extension function is not equivalent to using procedural style of programming. There's nothing procedural in extension functions, which do not depend on the state of the outer world and do not alter anything -- e.g. calculation of sin(), cos(),... etc. I agree with you that even using such extension functions may have its drawbacks, but due to another reason -- this will significantly affect the portability of an xslt application. Even when having extension functions with side effects, there is nothing bad if we can control them in a reliable way. This has been done in other functional languages (e.g. in Haskell by using monads). Right at this moment I'm finishing the first implementation of a set of templates that provides functionality roughly equal to that of a Monad. This will be included in the next release of FXSL. This allows using extension functions with side effects in a controlled manner and generally gives the ability to write reliable imperative-styled code in XSLT. ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to Align Text in the , W. Eliot Kimber | Thread | RE: [xsl] xslt style, David . Pawson |
RE: [xsl] xslt style, David . Pawson | Date | Re: [xsl] Translating the contents , Jeni Tennison |
Month |