通过消除累积最大和增加3个脚本functoid的,在做另一种方式的计算,问题就解决了。 映射时间减少了40倍。
11 Mb,10 000行,之前映射的200分钟现在映射在5分钟内。
解
一个脚本functoid,“内联XSLT呼叫模板”没有输入或输出,从EXSLT Math library found here含有库的MAX()部分。我不使用整个库,而是解压缩文件并“提取”max()模板。
<xsl:template name="GetMax">
<xsl:param name="nodes" />
<xsl:choose>
<xsl:when test="not($nodes)">NaN</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$nodes">
<xsl:sort data-type="number" order="descending" />
<xsl:if test="position() = 1">
<xsl:value-of select="number(.)" />
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
一个脚本functoid,“内联XSLT呼叫模板”没有输入或输出,含有选择在模板设置为计算
<xsl:variable name="var:MaxValueDate">
<xsl:call-template name ="GetMax">
<xsl:with-param name ="nodes" select="Root//Parent/ValueToCalculate" />
</xsl:call-template>
</xsl:variable>
一个脚本functoid节点属性点的变量,带有一个输出的“内联XSLT”,使用该变量用其值填充输出元素。
<OutputElement>
<xsl:value-of select="$var:MaxValueDate" />
</OutputElement>
瞧!
@Martin,你可以编辑并使你的问题更明确吗? – 2009-06-01 08:30:02