0
Xpath 1.0とXalanJ 2.7.1でxslt 1.0を使用します。 テンプレートのプロファイリングを行い、通話時間を短縮しようとします。だから、うちの最大のホットスポットがある:XSLT 1.0を使用したテンプレートのxslt処理中の最適化?
<xsl:template name="tplAttribute">
<xsl:param name="sourceObject" />
<xsl:param name="sourceName" />
<xsl:param name="targetName" />
<xsl:variable name="sourceAttribute" select="$sourceObject/attribute[@name = $sourceName]" />
<xsl:if test="$sourceAttribute">
<dcx:attribute name="{$targetName}">
<xsl:value-of select="$sourceAttribute" />
</attribute>
</xsl:if>
</xsl:template>
871本のヒット時の平均時間は103と、可変59msのためです。
変換の時間を短縮するために、より良い解決策はありますか?
編集:ときプロセス 入力構造テンプレートを呼び出し、 'sourceObject':
object
tplAttribute
tplAttribute
tplAttributeDefault
tplAttribute
tplAttributeSomeDifferentLogic
tplAttribute
tplAttributeOther
通常、いくつの「属性」要素が$ sourceObjectの子として検出されますか? –
20から100までですが、$ sourceObjectがありますので、その中に特定の属性を見つけなければなりません。しかし、それから別のものを探す必要があります。状況によっては、tplAttributeOtherなどのロジックが異なるため、変数の作成によって処理が遅くなったり、sourceAttributeではなく2つの選択肢がある場合は、プロセッサの最適化に基づいてより高速になります。 – Xelian
私はXalanの内部を知らない。 Saxon-EEは、おそらくこれを評価するための指標を作成します。試して結果をお知らせください。 –