The greater performance in XSLT when writing an XHTML element

Finding better performance in XSLT: xsl: element name = "div" vs. <div>

The greater performance in XSLT when writing an XHTML element

<xsl:element name="div">
  <xsl:attribute name="class">someclass</xsl:attribute>
</xsl:element>

or just write

<div class="someclass"></div>

Does the difference in performance / performance, etc., matter?

+3
source share
5 answers

I suspected that XSLT compilers probably convert one to another inside and, of course, at least some of them do:

Literal result elements are now compiled internally to the xsl: xsl: attribute instructions element. This leads to changes in the trace: each attribute is now traced as a separate instruction.

-, , .

+3

XSL- . saxonb-xslt 9: .

+1

. , XSL, , , .

, , XSL, 10 000 , . 10 000, .

XSL . xsl: , HTML. , XSL , XML/XSL, - .

+1

, XSLT. , ​​ , . XSLT-, , xsl: , , , , .

0

You will not get a reasonable performance boost from such refactoring (can you feel the difference in microseconds)?

However, I highly recommend using the most readable version :

<div class="someclass"/>

Even if the element has attributes whose value is dynamically calculated, always try to write :

<someElement attr="{someExpression}"/>

instead:

<someElement>
 <xsl:attribute name="attr">
  <xsl:value-of select="someExpression"/>
 </xsl:attribute>
</someElement>
0
source

Source: https://habr.com/ru/post/1796688/


All Articles