archrelease: copy trunk to extra-x86_64
[arch-packages.git] / docbook-xsl / repos / extra-any / 765567_non-recursive_string_subst.patch
blobae845ad00767f28c2ba6410726f6a214aa4087fe
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
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 @@
11 This module implements DTD-independent functions
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">
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"/>
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">