[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Bad programmers use recursion, xslt (Offtopic...)
> Regarding xslt, what I have always wondered is whether > there are many (enough?) cases where having stateful > alternative (with real variables or such to store > state) would have benefits: it seems as if computing > certain things just once (or cumulatively) could yield > significant improvements. Not sure if related but I found in my experience that sometimes splitting a single XSLT1.0 transformation into two transformations could bring good if not big performance improvements. In the first pass you prepare the intermediate structures you need and and in some way you add them to the source. In the second pass you exploit these pre-prepared structures saving the effort of calculating them on the fly (lookup, sort etc). They are already prepared by you in the first pass with the flavour you like. Of course not always is possible. I think is an intutive way to simulate state in a "transformation-oriented" way ;-) Not sure about this but I think is not the same state one thinks normally about, the "real variables", is a sort of snapshot of the previous transformations. I think multiple transformations is a different approach than trying to do all in one shot, that is what one tends to do normally. IN FAVOUR : In this approach making a transformation is like calling a function and the input tree is the parameter: the nice thing is that function implementation (xslt) might be optimized. Additionally I found that doing more transformations is faster, especially for very complex transformations and the single stylesheets look easier. As in standard functional programming you decide the order of function calling, implementation of the function might be able to be simultanously run by multiple cpu, I will risk saying also that each transformation is like a barrier (that gives some rest to your recursive thinking). AGAINST: In my opinion is very difficult to think in terms of multiple transformations. One reason might be that we are not used to, an other might be that if one does not define very well the "xml interfaces" to communicate between stylesheets (the structure of the xml trees input of each stylesheet) it becomes very difficult to understand, document and debug them. For example if one stylesheet depends on the output of more than one other stylesheet you risk when touching the first in the chain to have to change all the others and not only the following one. I tried to find something that allows you to do multiple transformations in a declarative way but I did not find much. This might be related to the state/functions argument, but not sure how. http://fxsl.sourceforge.net/articles/PartialApps/Partial%20Applications.html Greetings. Michele ___________________________________ Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive http://it.messenger.yahoo.com
|
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
|