我认为变量可以通过几种不同的方式初始化,我想知道一种方法可能更有效,还是可以帮助改善处理大量数据时的转换时间。
以下是我如何声明变量的两个例子:
<xsl:variable name="sampleVariable" select="$thisNodeSet[string-length($currentName) > 0 and @NAME=$currentname]
| $thisNodeSet[string-length($currentNameInstance) > 0 and contains(@INSTANCE, $currentNameInstance)]
| $thisNodeSet[string-length($currentName) <= 0 and string-length($currentNameInstance) <= 0]" />
OR
<xsl:variable name="sampleVariable">
<xsl:choose>
<xsl:when test="string-length($currentName)>0">
<xsl:copy-of select="$thisNodeSet[@NAME=$currentname] />
</xsl:when>
<xsl:when test="string-length($currentNameInstance)>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处理器