We have a third party application that uses XSLTs extensively and the sizes of the template files can be pretty significant. We are trying to address issues such as the parser that is used, whether the XSLTs are cached, etc. In reference to the XSLT itself and the logic within it, I have two questions regarding performance:
In regards to xsl:element, is there a performance difference in the two statements because the first code segment happens all the time in the codebase instead of using shorthand to create the input element:
Code:
<xsl:element name="input">
<xsl:attribute name="type">hidden</xsl:attribute>
<xsl:attribute name="name">s_regionalLocationInd<xsl:value-of select="i_queueCodeID"/></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="s_regionalLocationInd"/></xsl:attribute>
</xsl:element>
Code:
<input type="hidden" name="s_regionalLocationInd{i_queueCodeID}" value="{s_regionalLocationInd}"/>
Also, developers don't remove unused code and instead comment the code out using HTML comment tags. Also, there is a lot of indentation and whitespace that occurs because of pretty printing. Now if this was XML loaded into a DOM, all the comments and pretty printing would add significant size to the DOM representation in memory. Does this work the same with an XSLT parser? Even though HTML comments are not transferred to the output document, do they change the size of the XSLT object in memory? Would "unpretty printing" the XSLT in production help to lower the size of the XSLT in memory?
Thanks,
Jay