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

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