about summary refs log tree commit diff
path: root/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/docbook-xsl-ns-infinite.patch
blob: 5729f9b43c80bb2c0a2a8f4e978d116285020da3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Remove infinite recursion
Attribute: docbook5_xsl
Version: 1.79.1
URL: https://github.com/NixOS/nixpkgs/issues/39090
diff -ru a/lib/lib.xsl b/lib/lib.xsl
--- a/lib/lib.xsl	2015-12-26 15:15:37.000000000 -0800
+++ b/lib/lib.xsl	2018-03-22 11:52:45.311949264 -0700
@@ -11,8 +11,10 @@
 
      ******************************************************************** -->
 <xsl:stylesheet exclude-result-prefixes="d"
-                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook"
-version="1.0">
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+                xmlns:str="http://exslt.org/strings"
+                version="1.0">
 
 <xsl:template name="dot.count">
   <!-- Returns the number of "." characters in a string -->
@@ -58,6 +61,9 @@
   <xsl:param name="replacement"/>
 
   <xsl:choose>
+    <xsl:when test="function-available('str:replace')">
+      <xsl:value-of select="str:replace($string, string($target), string($replacement))"/>
+    </xsl:when>
     <xsl:when test="contains($string, $target)">
       <xsl:variable name="rest">
         <xsl:call-template name="string.subst">