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

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