From e5e028b4bf196f980adba1b3110533a130c158ab Mon Sep 17 00:00:00 2001 From: Tom Schraitle Date: Mon, 13 Jan 2025 12:48:35 +0100 Subject: [PATCH] Changes the content In an assembly file, you can add or remove `` elements from `.` The stylesheet contains several checks: * Checks if the root element is `` and belongs to the DocBook 5 namespace. If not, it returns a error messages and refuses to continue * Checks if the required XSLT parameters version, product, and op are set. If not set, the stylesheet it returns a error messages and refuses to continue * Checks if there are more than one `` element. If yes, it's expected to set the structure.id parameter * Checks if the ID of the `` is there. If not, the stylesheet it returns a error messages and refuses to continue * Checks, if there is a `` element. If not, the stylesheet returns a warning and continues * When op = "add" and there is already an existing `` with the same content, return a warning and continue * When op = "remove" and there is no `` with the requested content, return a warning and continue. For example: $ xsltproc --stringparam op add \ --stringparam version "16-SP1" \ --stringparam product "SLES" \ $DAPS_PATH/daps-xslt/contrib/change-products-on-assembly.xsl \ articles/Micro-upgrade.asm.xml --- .../contrib/change-products-on-assembly.xsl | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 daps-xslt/contrib/change-products-on-assembly.xsl diff --git a/daps-xslt/contrib/change-products-on-assembly.xsl b/daps-xslt/contrib/change-products-on-assembly.xsl new file mode 100644 index 000000000..601727cc6 --- /dev/null +++ b/daps-xslt/contrib/change-products-on-assembly.xsl @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + XSLT Parameter 'version' not set + + + + + XSLT Parameter 'product' not set + + + + + XSLT Parameter 'op' not set + + + + ; + + + + + + + + + + + + ERROR: This document is NOT an assembly file + + + + + + + + ERROR: The document contains more than one structure. + Choose the structure you want to change with the XSLT parameter `structure.id'. Either: + 1. Use the ID of the structure: structure.id="ID" + 2. Use structure.id='#all' to change all <structure>s in the assembly. + + + + + + + + ERROR: ID ' + + ' not found in assembly. + + + + INFO: Selecting structure + + + + + + + + WARNING: No <meta name="productname"> found in structure + + + + + + + + + add + remove + remove + + + + INFO: Found <meta name="productname"> + INFO: Found productnames for + version = + product = + => + + + + + + INFO: Adding <productname version=""></productname> + + + + + + WARNING: The <productname version=""></productname> already exists + + + + WARNING: Cannot remove <productname version=""></productname>; does NOT exist + + + + INFO: Removing <productname version=""></productname> + + + + Is this correct? Should that be happen? + + + + + + \ No newline at end of file