Subject: Re: efficiency and replace()
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sun, 10 Sep 2006 17:10:07 +0100
|
in general, for params and variables its better not to do this:
<xsl:with-param name="troff">\\\(\?s</xsl:with-param>
and instead do this:
<xsl:with-param name="troff" select="'\\\(\?s'"/>
so it gets set to a string rather than a temporary tree with a document
node, a text node child, which is more expensive to build.
It depends a bit what the ascii transliteration looks like but it looks
like it would be worth merging some of the replacements to save
repeatedly re-searching for \\\(
something like
<xsl:analyze-string select="." regex="\\\\\\(\\\?([a-z])"
<xsl:matching-string>
<xsl:choose>
<xsl:when test="regex-group(1)='s'">...
<xsl:when test="regex-group(1)='c'">...
David
|