<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Description: use EXSLT "replace" function when available
 A recursive implementation  of string.subst is problematic,
 long strings with many matches will cause stack overflows.
Author: Peter De Wachter &lt;pdewacht@gmail.com&gt;
Bug-Debian: https://bugs.debian.org/750593

--- lib/lib.xsl.orig
+++ lib/lib.xsl
@@ -6,7 +6,10 @@
 
      This module implements DTD-independent functions
 
-     ******************************************************************** --&gt;&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
+     ******************************************************************** --&gt;&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:str="http://exslt.org/strings"
+                exclude-result-prefixes="str"
+                version="1.0"&gt;
 
 &lt;xsl:template name="dot.count"&gt;
   &lt;!-- Returns the number of "." characters in a string --&gt;
@@ -52,6 +56,9 @@
   &lt;xsl:param name="replacement"/&gt;
 
   &lt;xsl:choose&gt;
+    &lt;xsl:when test="function-available('str:replace')"&gt;
+      &lt;xsl:value-of select="str:replace($string, string($target), string($replacement))"/&gt;
+    &lt;/xsl:when&gt;
     &lt;xsl:when test="contains($string, $target)"&gt;
       &lt;xsl:variable name="rest"&gt;
         &lt;xsl:call-template name="string.subst"&gt;
</pre></body></html>