XSLT不同变量声明方法的性能差异

时间:2017-03-31 18:40:04

标签: performance xslt xslt-1.0

我认为变量可以通过几种不同的方式初始化,我想知道一种方法可能更有效,还是可以帮助改善处理大量数据时的转换时间。

以下是我如何声明变量的两个例子:

<xsl:variable name="sampleVariable" select="$thisNodeSet[string-length($currentName) &gt; 0 and @NAME=$currentname]
                                            | $thisNodeSet[string-length($currentNameInstance) &gt; 0 and contains(@INSTANCE, $currentNameInstance)]
                                            | $thisNodeSet[string-length($currentName) &lt;= 0 and string-length($currentNameInstance) &lt;= 0]" />

OR

<xsl:variable name="sampleVariable">
    <xsl:choose>
         <xsl:when test="string-length($currentName)&gt;0">
                    <xsl:copy-of select="$thisNodeSet[@NAME=$currentname] /> 
         </xsl:when>
         <xsl:when test="string-length($currentNameInstance)&gt;0">
                    <xsl:copy-of select="$thisNodeSet[contains(@INSTANCE, $currentNameInstance)]" />
         </xsl:when>
         <xsl:otherwise>
                    <xsl:copy-of select="$thisNodeSet" />
         </xsl:otherwise>
     </xsl:choose>
</xsl:variable>

我不确定每个操作如何存储节点,并想知道xsl:copy-of是否会以某种方式在内存中存储更多内容。

我的问题是这些方法中的一种是否更快/更有效,或者它们是否会在转换时间,内存或其他任何可能受这些方法影响的方面具有相似的性能。

感谢您的帮助!

编辑:它使用的是MSXML处理器

0 个答案:

没有答案