summaryrefslogtreecommitdiffstats
path: root/merge_doc.xsl
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2018-11-12 12:17:13 +0100
committerOliver Smith <osmith@sysmocom.de>2018-11-12 12:18:41 +0100
commit161365fa6f1bed8e1309f85fa27d0f53f88fbd73 (patch)
treedf017567e2a159591678c2701d7d50bda5efbd09 /merge_doc.xsl
parent10ffc822374c73d2204aff362cb8da20baab48ab (diff)
merge_doc.xsl: move from libosmocore.git
Allow building manuals without the libosmocore source. Related: OS#3385 Change-Id: Ifb81b18422987cdf36b75993d2782abf93b5f48c
Diffstat (limited to 'merge_doc.xsl')
-rw-r--r--merge_doc.xsl48
1 files changed, 48 insertions, 0 deletions
diff --git a/merge_doc.xsl b/merge_doc.xsl
new file mode 100644
index 0000000..d75c499
--- /dev/null
+++ b/merge_doc.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:vty="urn:osmocom:xml:libosmocore:vty:doc:1.0">
+ <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
+
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+ </xsl:copy>
+ </xsl:template>
+
+
+ <!-- Copy the name of the node -->
+ <xsl:template match="vty:node">
+ <xsl:variable name="info" select="document($with)/vty:vtydoc/vty:node[@id=current()/@id]/." />
+ <xsl:if test="not($info/vty:hide)">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+ <xsl:for-each select="$info/*">
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- Copy command and add nodes -->
+ <xsl:template match="vty:command">
+ <xsl:variable name="info" select="document($with)/vty:vtydoc/vty:node[@id=current()/../@id]/vty:command[@id=current()/@id]/." />
+ <xsl:variable name="info_generic" select="document($with)/vty:vtydoc/vty:common/vty:command[@id=current()/@id]/." />
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+
+ <!-- Copy the specific issue... -->
+ <xsl:for-each select="$info/*">
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+
+ <xsl:if test="not($info)">
+ <xsl:for-each select="$info_generic/*">
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:copy>
+ </xsl:template>
+</xsl:transform>
+