]>
Commit | Line | Data |
---|---|---|
1e2946d6 AM |
1 | Description: use EXSLT "replace" function when available |
2 | A recursive implementation of string.subst is problematic, | |
3 | long strings with many matches will cause stack overflows. | |
4 | Author: Peter De Wachter <pdewacht@gmail.com> | |
5 | Bug-Debian: https://bugs.debian.org/750593 | |
6 | ||
7 | --- docbook-xsl-1.78.1+dfsg.orig/docbook-xsl/lib/lib.xsl | |
8 | +++ docbook-xsl-1.78.1+dfsg/docbook-xsl/lib/lib.xsl | |
9 | @@ -10,7 +10,10 @@ | |
10 | ||
11 | This module implements DTD-independent functions | |
12 | ||
13 | - ******************************************************************** --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
14 | + ******************************************************************** --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
15 | + xmlns:str="http://exslt.org/strings" | |
16 | + exclude-result-prefixes="str" | |
17 | + version="1.0"> | |
18 | ||
19 | <xsl:template name="dot.count"> | |
20 | <!-- Returns the number of "." characters in a string --> | |
21 | @@ -56,6 +59,9 @@ | |
22 | <xsl:param name="replacement"/> | |
23 | ||
24 | <xsl:choose> | |
25 | + <xsl:when test="function-available('str:replace')"> | |
26 | + <xsl:value-of select="str:replace($string, string($target), string($replacement))"/> | |
27 | + </xsl:when> | |
28 | <xsl:when test="contains($string, $target)"> | |
29 | <xsl:variable name="rest"> | |
30 | <xsl:call-template name="string.subst"> |