From: Bruno Victal <mirai@makinata.eu>
To: 61015@debbugs.gnu.org
Cc: Bruno Victal <mirai@makinata.eu>
Subject: [bug#61015] [PATCH v2 3/4] gnu: docbook-xml: Use XSLT to patch catalog.xml.
Date: Sat, 11 Mar 2023 17:54:12 +0000 [thread overview]
Message-ID: <dd445d0230a54b07e89cd1be56ed63b450ec65e0.1678557210.git.mirai@makinata.eu> (raw)
In-Reply-To: <821b168ca199012a29d7a95961c6380b40e46855.1678557210.git.mirai@makinata.eu>
(sxml transforms) are unsuited here due to guile-bug #20339.
* gnu/packages/aux-files/xml/patch-catalog-xml.xsl: New file.
* Makefile.am: Register it.
* gnu/packages/docbook.scm (docbook-xml-5)[native-inputs]: Add libxslt.
[arguments]: Add phase to patch catalog.xml using XSLT.
---
Makefile.am | 3 ++-
.../aux-files/xml/patch-catalog-xml.xsl | 24 +++++++++++++++++++
gnu/packages/docbook.scm | 14 ++++++++++-
3 files changed, 39 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/aux-files/xml/patch-catalog-xml.xsl
diff --git a/Makefile.am b/Makefile.am
index 23b939b674..73369c746c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -436,7 +436,8 @@ AUX_FILES = \
gnu/packages/aux-files/python/sanity-check-next.py \
gnu/packages/aux-files/python/sitecustomize.py \
gnu/packages/aux-files/renpy/renpy.in \
- gnu/packages/aux-files/run-in-namespace.c
+ gnu/packages/aux-files/run-in-namespace.c \
+ gnu/packages/aux-files/xml/patch-catalog-xml.xsl
# Templates, examples.
EXAMPLES = \
diff --git a/gnu/packages/aux-files/xml/patch-catalog-xml.xsl b/gnu/packages/aux-files/xml/patch-catalog-xml.xsl
new file mode 100644
index 0000000000..947517476d
--- /dev/null
+++ b/gnu/packages/aux-files/xml/patch-catalog-xml.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 6a8eeec386..2d11333608 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,22 @@ (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-catalog-xml
+ (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-catalog-xml.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.39.1
next prev parent reply other threads:[~2023-03-11 17:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 3:31 [bug#61015] [PATCH core-updates 0/9] Modernize and fix docbook-xml Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 1/9] gnu: docbook-xml: Use copy-build-system Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 2/9] gnu: docbook-xml-4.1.2: Adapt to copy-build-system Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 3/9] gnu: docbook-xml: " Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 4/9] gnu: docbook-xml-4.4: " Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 5/9] gnu: docbook-xml-4.3: " Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 6/9] gnu: docbook-xml-4.2: " Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 7/9] gnu: docbook-xml: Fix permissions Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 8/9] gnu: docbook-xml: Use XSLT to patch catalog.xml Bruno Victal
2023-01-23 3:32 ` [bug#61015] [PATCH core-updates 9/9] gnu: docbook-xml-4.1.2: Add missing catalog.xml Bruno Victal
2023-03-06 15:22 ` [bug#61015] [PATCH core-updates 0/9] Modernize and fix docbook-xml Bruno Victal
2023-03-11 17:54 ` [bug#61015] [PATCH v2 1/4] gnu: docbook-xml: Use copy-build-system Bruno Victal
2023-03-11 17:54 ` [bug#61015] [PATCH v2 2/4] gnu: docbook-xml: Fix permissions Bruno Victal
2023-03-11 17:54 ` Bruno Victal [this message]
2023-03-11 17:54 ` [bug#61015] [PATCH v2 4/4] gnu: docbook-xml-4.1.2: Add missing catalog.xml Bruno Victal
2023-04-21 4:45 ` bug#61015: [PATCH core-updates 0/9] Modernize and fix docbook-xml Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd445d0230a54b07e89cd1be56ed63b450ec65e0.1678557210.git.mirai@makinata.eu \
--to=mirai@makinata.eu \
--cc=61015@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.