Annotation of /trunk/docbook-xsl-stylesheets/patches/docbook-xsl-stylesheets-1.79.2-non-recursive.patch
Parent Directory | Revision Log
Revision 3006 -
(hide annotations)
(download)
Mon Oct 23 08:49:43 2017 UTC (6 years, 11 months ago) by niro
File size: 1356 byte(s)
Mon Oct 23 08:49:43 2017 UTC (6 years, 11 months ago) by niro
File size: 1356 byte(s)
-added non-recursive patch
1 | niro | 3006 | 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 | @@ -6,7 +6,11 @@ | ||
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 | + ******************************************************************** --> | ||
15 | +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
16 | + xmlns:str="http://exslt.org/strings" | ||
17 | + exclude-result-prefixes="str" | ||
18 | + version="1.0"> | ||
19 | |||
20 | <xsl:template name="dot.count"> | ||
21 | <!-- Returns the number of "." characters in a string --> | ||
22 | @@ -52,6 +56,9 @@ | ||
23 | <xsl:param name="replacement"/> | ||
24 | |||
25 | <xsl:choose> | ||
26 | + <xsl:when test="function-available('str:replace')"> | ||
27 | + <xsl:value-of select="str:replace($string, string($target), string($replacement))"/> | ||
28 | + </xsl:when> | ||
29 | <xsl:when test="contains($string, $target)"> | ||
30 | <xsl:variable name="rest"> | ||
31 | <xsl:call-template name="string.subst"> | ||
32 |