Skip to content

Instantly share code, notes, and snippets.

@eerohele
Created October 21, 2015 13:23
Show Gist options
  • Save eerohele/cc7da6408782f1897ad1 to your computer and use it in GitHub Desktop.
Save eerohele/cc7da6408782f1897ad1 to your computer and use it in GitHub Desktop.
DITA-OT XSLT stylesheet performance optimization #2
<?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"/>
<xsl:template match="topicref[contains(@class, ' map/topicref ')][last()]">
<xsl:message><xsl:value-of select="count(preceding::topicref[contains(@class, ' map/topicref ')])"/></xsl:message>
</xsl:template>
</xsl:stylesheet>
<!-- *** Average execution time over last 1 runs: 53.014472s (53014.472349ms) -->
<?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"/>
<xsl:template match="*[contains(@class, ' map/topicref ')][last()]">
<xsl:message><xsl:value-of select="count(preceding::*[contains(@class, ' map/topicref ')])"/></xsl:message>
</xsl:template>
</xsl:stylesheet>
<!-- *** Average execution time over last 1 runs: 7m 43.372111s (463372.11177ms) -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment