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

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