summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/vty/example.xml22
-rw-r--r--doc/vty/merge_doc.xsl37
-rw-r--r--doc/vty/vtydoc.xsd46
3 files changed, 105 insertions, 0 deletions
diff --git a/doc/vty/example.xml b/doc/vty/example.xml
new file mode 100644
index 00000000..400c6340
--- /dev/null
+++ b/doc/vty/example.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vtydoc xmlns="urn:osmocom:xml:libosmocore:vty:doc:1.0">
+ <!-- test a nested hierachy -->
+ <node id="mgcp" name="MGCP Node">
+ <!-- define a command -->
+ <command id="foo_cmd">
+ <doc>General docs</doc>
+ <params>
+ <param name="do" doc="Explain do" />
+ <param name="fo" doc="Explain foo" />
+ </params>
+ </command>
+ <command id="foo_cmd">
+ <doc>General docs</doc>
+ <params>
+ <param name="do" doc="Explain do" />
+ <param name="fo" doc="Explain foo" />
+ </params>
+ </command>
+
+ </node>
+</vtydoc>
diff --git a/doc/vty/merge_doc.xsl b/doc/vty/merge_doc.xsl
new file mode 100644
index 00000000..6e1bab1d
--- /dev/null
+++ b/doc/vty/merge_doc.xsl
@@ -0,0 +1,37 @@
+<?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="ISO-8859-1" indent="yes" />
+ <xsl:variable name="with" select="'additions.xml'" />
+
+ <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:copy>
+ <xsl:apply-templates select="@*|node()" />
+ <xsl:variable name="info" select="document($with)/vty:vtydoc/vty:node[@id=current()/@id]/." />
+ <xsl:for-each select="$info/vty:name">
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+ </xsl:copy>
+ </xsl:template>
+
+
+ <!-- Copy command and add nodes -->
+ <xsl:template match="vty:command">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+ <xsl:variable name="info" select="document($with)/vty:vtydoc/vty:node[@id=current()/../@id]/vty:command[@id=current()/@id]/." />
+ <xsl:for-each select="$info/*">
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+ </xsl:copy>
+ </xsl:template>
+</xsl:transform>
+
diff --git a/doc/vty/vtydoc.xsd b/doc/vty/vtydoc.xsd
new file mode 100644
index 00000000..53a67a36
--- /dev/null
+++ b/doc/vty/vtydoc.xsd
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema
+ xmlns="urn:osmocom:xml:libosmocore:vty:doc:1.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:osmocom:xml:libosmocore:vty:doc:1.0"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:complexType name="ParamType">
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="doc" type="xs:string" use="required" />
+ </xs:complexType>
+
+ <xs:complexType name="ParamsType">
+ <xs:sequence>
+ <xs:element name="param" type="ParamType" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="CommandType">
+ <xs:sequence>
+ <xs:element name="doc" type="xs:string" minOccurs="0" maxOccurs="1" />
+ <xs:element name="params" type="ParamsType" minOccurs="1" maxOccurs="1"/>
+ <xs:element name="enter" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:string" use="required" />
+ </xs:complexType>
+
+ <xs:complexType name="NodeType">
+ <xs:sequence>
+ <xs:element name="command" type="CommandType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:anyURI"/>
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:complexType>
+
+ <!-- the main entry -->
+ <xs:element name="vtydoc">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="node" type="NodeType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+