Project

Profile

Help

Bug #2092 » keybug.xsl

Ronald Ikes, 2014-06-20 10:50

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>

<!-- This definition is fast -->
<xsl:key name="FastKey" match="*" use="@id,concat('#', @id)"/>

<!-- This definition is damn slow -->
<xsl:key name="SlowKey" match="*" use="@id"/>
<xsl:key name="SlowKey" match="*" use="concat('#', @id)"/>

<!-- start with the /PLMXML export root -->
<xsl:template match="/PLMXML">
<REPORT>
<xsl:message select="'DIRECT SEARCH: ',ProductRevision[@id eq 'id2']/@id"/>
<xsl:message select="'DIRECT SEARCH: ',ProductRevision[concat('#',@id) eq '#id2']/@id"/>
<xsl:message select="'KEY SEARCH no#: ',key('FastKey', 'id2')/@id"/>
<xsl:message select="'KEY SEARCH with#: ',key('FastKey', '#id2')/@id"/>
<!-- before the next line is printed it takes a long long time -->
<xsl:message select="'KEY SEARCH no#: ',key('SlowKey', 'id2')/@id"/>
<xsl:message select="'KEY SEARCH with#: ',key('SlowKey', '#id2')/@id"/>
</REPORT>
</xsl:template>

</xsl:stylesheet>
(2-2/2)