Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xml-dev] XSLT Element Performence

From: "Michael Kay" <michael.h.kay@--------.--->
To: "'Robert Hansson'" <Robert.Hansson@------.--->,<xml-dev@-----.---.--->
Date: 7/10/2004 10:39:00 AM
To emphasize what others have said, if your stylesheet has 
a significant performance problem then the difference between these two 
constructs is not going to make any useful contribution to solving 
it.
 
I do find, however, when I tackle a problem like this 
I like to start by tinkering away at the readability problems first, because 
after a few iterations of this the actual performance issue becomes much easier 
to spot.
 
As regards performance, I find the most important thing is 
to establish early on is how the stylesheet performance is affected by source 
document size. This can be done quite simply by creating source documents of a 
range of different sizes and plotting the elapsed time against size. If the 
results are non-linear, this tells you to look in the stylesheet for unnecessary 
document scans, often represented by absolute path expressions starting "/", or 
by use of the preceding and following axes.
 
Michael Kay


  
  
  From: Robert Hansson 
  [mailto:Robert.Hansson@o...] 
Sent: 06 July 2004 
  16:58
To: xml-dev@l...
Subject: [xml-dev] XSLT 
  Element Performence


  
  
  Hi!<o:p></o:p>
  <o:p> </o:p>
  I have been taking over a project 
  with thousands of lines of XSLT code that I need to change because of 
  performance and readability problems. About the performance issues I 
  <o:p></o:p>
  need someone to tell me which of 
  the following two examples is the best one for performance, what’s the 
  differences and what to think about.<o:p></o:p>
  <o:p> </o:p>
  Example 
  1:<o:p></o:p>
  <o:p> </o:p>
  <xsl:element 
  name="div"><xsl:attribute name="id"><xsl:value-of 
  select="@id"/></xsl:attribute></xsl:element><o:p></o:p>
  <o:p> </o:p>
  Example 
  2:<o:p></o:p>
  <o:p> </o:p>
  <div 
  id="{@id}"></div><o:p></o:p>
  <o:p> </o:p>
  <o:p> </o:p>
  Cheers,<o:p></o:p>
  <o:p> </o:p>
  Robert.<o:p></o:p>
_________________________________________________________________________________________________________________________
Internet 
  communications are not secure and therefore Oyster Partners Ltd does not 
  accept legal responsibility for the contents of this message. Any views or 
  opinions presented are solely those of the author and do not necessarily 
  represent those of Oyster Partners Ltd.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent