Finding better performance in XSLT: xsl: element name = "div" vs. <div>
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
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