Subject: Re: [xsl] A question on optimization From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 2 Nov 2004 13:39:15 GMT |
> Do you have any suggestions, how to implement the above very fast? For > example, is it possible, to create or modify a template at runtime? an xslt stylesheet is an xml document so you can transform it using various methods, not least another xslt stylesheet. The details depend on which API you are using. > it possible to at least read the attribute names into some kind of array > and iterate over the arrray elements? Or, anything else, ... XSLT doesn't have arrays, but attributes are nodes so of course you can have a node set of attribute nodes and iterate over that. For example <xsl:element name="td"><xsl: <xsl:attribute name="a1"><xsl:value-of select="@a1"/> </xsl:attribute> <xsl:attribute name="a2"><xsl:value-of select="@a2"/> </xsl:attribute> <xsl:attribute name="a3"><xsl:value-of select="@a3"/> </xsl:attribute> </xsl:element> could more easily be written <td> <xsl:copy-of select="@a1|@a2|@a3"/> </td> or <td> <xsl:copy-of select="@*[starts-with(name(),'a')]"/> </td> or whatever other node set you want to specify. It's unlikely to make any real difference on performace though. Time is far more likely to be spent on navigating the tree as a whole rather than on the fine details of the instructions used to generate a small local result fragment. Perhaps this is just a made up example, but it seems a bit odd, html td's don't have attributes a1 etc. Also your example didn't seem to match your description which said that the a1 a2 etc were dynamic and driven from the first row of the table, whereas your example has them as fixed names in the stylesheet and as attributes on the current node. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] A question on optimization, Jochen Wiedmann | Thread | Re: [xsl] A question on optimizatio, Jochen Wiedmann |
[xsl] A question on optimization, Jochen Wiedmann | Date | Re: [xsl] A question on optimizatio, Jochen Wiedmann |
Month |