Blame SOURCES/docbook-style-xsl-non-recursive-string-subst.patch

d1b6f5
Description: use EXSLT "replace" function when available
d1b6f5
 A recursive implementation  of string.subst is problematic,
d1b6f5
 long strings with many matches will cause stack overflows.
d1b6f5
Author: Peter De Wachter <pdewacht@gmail.com>
d1b6f5
Bug-Debian: https://bugs.debian.org/750593
d1b6f5
d1b6f5
--- docbook-xsl-1.78.1+dfsg.orig/docbook-xsl/lib/lib.xsl
d1b6f5
+++ docbook-xsl-1.78.1+dfsg/docbook-xsl/lib/lib.xsl
d1b6f5
@@ -10,7 +10,10 @@
d1b6f5
 
d1b6f5
      This module implements DTD-independent functions
d1b6f5
 
d1b6f5
-     ******************************************************************** --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
d1b6f5
+     ******************************************************************** -->
d1b6f5
+                xmlns:str="http://exslt.org/strings"
d1b6f5
+                exclude-result-prefixes="str"
d1b6f5
+                version="1.0">
d1b6f5
 
d1b6f5
 <xsl:template name="dot.count">
d1b6f5
   
d1b6f5
@@ -56,6 +59,9 @@
d1b6f5
   <xsl:param name="replacement"/>
d1b6f5
 
d1b6f5
   <xsl:choose>
d1b6f5
+    <xsl:when test="function-available('str:replace')">
d1b6f5
+      <xsl:value-of select="str:replace($string, string($target), string($replacement))"/>
d1b6f5
+    </xsl:when>
d1b6f5
     <xsl:when test="contains($string, $target)">
d1b6f5
       <xsl:variable name="rest">
d1b6f5
         <xsl:call-template name="string.subst">