summaryrefslogtreecommitdiff
path: root/docbook-xsl/non-recursive-string-subst.patch
blob: ae845ad00767f28c2ba6410726f6a214aa4087fe (plain)
    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
    6 
    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 @@
   10  
   11       This module implements DTD-independent functions
   12  
   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">
   19  
   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"/>
   24  
   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">

Generated by cgit