Subject: Re: [xsl] Newbie XSL Evaluation From: "cutlass" <cutlass@xxxxxxxxxxx> Date: Tue, 23 Apr 2002 17:50:17 +0100 |
Hello Patrice, ----- Original Message ----- From: <sicaudp@xxxxxxxxxxxxxx> > I could not resist exposing myself to mischief. I am a newbie in XSLT and I > have written an XSL file which works fine. I was curious however to find out > how the pros would have actually done it. So here goes, I am appending the > XSL, the source XML and the expected result. As I said, it all works but it > is probably not the most efficient way to go. after taking a short look [ note, this are not criticisms just commenting, only you know why you need this... ] a) when posting xslt, make sure its apparant that u are injecting some params... otherwise folks will poke pins in little dolls...,only comment is that since the params are absolutely neccesary you should probably put a default value on the select statement. b) i suspect you have invested some time and effort in some existing javascript that require the heavy use of arrays...and u are augmenting with this transform, in general i think that you are probably mixing imperative programming logic with functional....a mite. - you may find instead of explicitly declaring array values, that if you instantiate the transform within the browser ( using IE or NN ) instead of a straight transformation that you could use some more efficient manipulation using DOM cleverness; as essentially instead of accessing values from an array....you could access them direct from the DOM; and then u get to learn more XPATH fun. Differently, you may be able to design an output xml structure that mimics your array requirements, so the result of your transform is an xml nodeset for loading into the DOM, or straight explicit printing c) you really only need to use <xsl:text/> elements if u need to ( it makes your template quite unreadable ) handle spacing ( remember the <xsl:preserve-space elements=""/>, <xsl:strip-space elements="*"/> tags ? ); though admittedly this can be trickly ( review Allouche method ) d) you have 2 nested xsl:for-each's that could be broken up into templates or named recursive templates e) you could have this generated as a seperate text (aka <xsl:output method="text"/> ) for modularity to your html using either include or import hth, jim fuller XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Newbie XSL Evaluation, sicaudp | Thread | RE: [xsl] How do you use the URIRes, Onaindia, Juan |
[xsl] structuring templates to gene, Andrew Welch | Date | RE: [xsl] How to create tables from, McNally, David |
Month |