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
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
11 This module implements DTD-independent functions
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"
20 <xsl:template name="dot.count">
21 <!-- Returns the number of "." characters in a string -->
23 <xsl:param name="replacement"/>
26 + <xsl:when test="function-available('str:replace')">
27 + <xsl:value-of select="str:replace($string, string($target), string($replacement))"/>
29 <xsl:when test="contains($string, $target)">
30 <xsl:variable name="rest">
31 <xsl:call-template name="string.subst">