Tim Chen schrieb:
Hi,
When I have a xsl:key who's select results in no nodes, I notice a
ridiculous increase in processing time.
Below is an example that runs in 4ms when the select returns nodes and
2400ms when no nodes are in the key.
I can confirm this using LibXSLT 1.1.22.
Here's the OP's stylesheet reformatted and a line to generate the
document:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text" version="1.0" encoding="utf-8" indent="no"/>
<!--
<xsl:key name="idKey" match="/document/[EMAIL PROTECTED]'2000']" use="@id"/>
-->
<xsl:key name="idKey" match="/document/[EMAIL PROTECTED]'-1']" use="@id"/>
<xsl:template match="/">
<xsl:value-of select="count( key('idKey', /document/node/@id) )"/>
</xsl:template>
</xsl:stylesheet>
perl -lwe 'print for q{<document>}, map( qq{<node id="$_"/>}, 1 ..
2000), q{</document>}'
Michael Ludwig
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
http://mail.gnome.org/mailman/listinfo/xslt