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

Re: A question on optimization

Subject: Re: A question on optimization
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 2 Nov 2004 13:39:15 GMT
copy of select navigating
> 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

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.