[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#61015] [PATCH core-updates 8/9] gnu: docbook-xml: Use XSLT to patch
From: |
Bruno Victal |
Subject: |
[bug#61015] [PATCH core-updates 8/9] gnu: docbook-xml: Use XSLT to patch catalog.xml. |
Date: |
Mon, 23 Jan 2023 03:32:54 +0000 |
(sxml transforms) are unsuited here due to guile-bug #20339.
* gnu/packages/aux-files/xml/patch-uri.xsl: New file.
* gnu/packages/docbook.scm (docbook-xml-5)
[native-inputs]: Add libxslt.
[arguments]: Patch catalog.xml using XSLT.
---
gnu/packages/aux-files/xml/patch-uri.xsl | 24 ++++++++++++++++++++++++
gnu/packages/docbook.scm | 13 ++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/aux-files/xml/patch-uri.xsl
diff --git a/gnu/packages/aux-files/xml/patch-uri.xsl
b/gnu/packages/aux-files/xml/patch-uri.xsl
new file mode 100644
index 0000000000..947517476d
--- /dev/null
+++ b/gnu/packages/aux-files/xml/patch-uri.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+SPDX-FileCopyrightText: 2023 Bruno Victal <mirai@makinata.eu>
+SPDX-License-Identifier: ISC
+
+Fix uri attributes to point to paths in the store.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml"/>
+ <xsl:param name="prefix">/</xsl:param>
+ <!-- begin identity transform -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+ <!-- end identity transform -->
+
+ <xsl:template match="@uri">
+ <xsl:attribute name="uri">
+ <xsl:value-of select="concat('file://', $prefix, '/', .)"/>
+ </xsl:attribute>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index b1743baf5e..ce0b823e3a 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -71,11 +72,21 @@ (define-public docbook-xml-5
(lambda _
;; XXX: These files do not need 0755 permission.
(for-each (cut chmod <> #o644) (find-files "."))))
+ (add-before 'install 'patch-uri
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((xsltproc (search-input-file inputs "/bin/xsltproc"))
+ (dtd-path (string-append #$output "/xml/dtd/docbook")))
+ (invoke xsltproc "--nonet" "--noout"
+ "--stringparam" "prefix" dtd-path
+ "--output" "catalog.xml.new"
+ #$(local-file (search-auxiliary-file
"xml/patch-uri.xsl"))
+ "catalog.xml")
+ (rename-file "catalog.xml.new" "catalog.xml"))))
(replace 'install
(lambda _
(let ((dtd-path (string-append #$output "/xml/dtd/docbook")))
(copy-recursively "." dtd-path)))))))
- (native-inputs (list unzip))
+ (native-inputs (list libxslt unzip))
(home-page "https://docbook.org")
(synopsis "DocBook XML DTDs for document authoring")
(description
--
2.38.1
- [bug#61015] [PATCH core-updates 0/9] Modernize and fix docbook-xml, Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 1/9] gnu: docbook-xml: Use copy-build-system., Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 2/9] gnu: docbook-xml-4.1.2: Adapt to copy-build-system., Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 3/9] gnu: docbook-xml: Adapt to copy-build-system., Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 4/9] gnu: docbook-xml-4.4: Adapt to copy-build-system., Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 5/9] gnu: docbook-xml-4.3: Adapt to copy-build-system., Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 6/9] gnu: docbook-xml-4.2: Adapt to copy-build-system., Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 7/9] gnu: docbook-xml: Fix permissions., Bruno Victal, 2023/01/22
- [bug#61015] [PATCH core-updates 8/9] gnu: docbook-xml: Use XSLT to patch catalog.xml.,
Bruno Victal <=
- [bug#61015] [PATCH core-updates 9/9] gnu: docbook-xml-4.1.2: Add missing catalog.xml., Bruno Victal, 2023/01/22