summaryrefslogtreecommitdiffstats
path: root/vty_reference.xsl
blob: d7aaa8b2cd3565e9143bd6c4088d7c45f89c07b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?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" />

  <!-- tick off the filtering -->
  <xsl:template match="@*|node()">
    <xsl:apply-templates select="@*|node()" />
  </xsl:template>

  <!-- every node into a new file -->
  <xsl:template match="vty:node">
    <xsl:variable name="filename" select="concat('generated/docbook_vty_', @id, '.xml')" />
<!-- create a new section -->
<section>
    <title><xsl:value-of select="./vty:name" /></title>
    <para><xsl:value-of select="./vty:description" /></para>

    <!-- each command into a subsection now -->
    <xsl:for-each select="./vty:command">
      <xsl:sort select="@id" />
      <section>
        <xsl:choose>
          <xsl:when test="string-length(@id) &gt; 80">
            <title><xsl:value-of select="substring(@id, 1, 80)"/>...</title>
          </xsl:when>
          <xsl:otherwise>
            <title><xsl:value-of select="@id"/></title>
          </xsl:otherwise>
        </xsl:choose>

        <xsl:if test="./vty:description">
          <para><xsl:value-of select="./vty:description" /></para>
        </xsl:if>

        <variablelist><varlistentry>
            <listitem>
              <para>Command</para>
              <screen><xsl:value-of select="@id" /></screen>
            </listitem>
        </varlistentry></variablelist>

      <!-- Unfortunately, there is no xsl:function support in XSL 1.0 -->

      <!-- Print global attributes (if any) -->
      <xsl:if test="./vty:attributes[@scope='global']">
        <variablelist>
          <varlistentry>
            <listitem>
              <para>Global attributes</para>
            </listitem>
          </varlistentry>
        <xsl:for-each select="./vty:attributes[@scope='global']/*">
          <varlistentry>
            <listitem>
              <xsl:choose>
                <xsl:when test="@flag">
                  <para>Flag: <xsl:value-of select="@flag" /></para>
                </xsl:when>
                <xsl:otherwise>
                  <para>Flag: (not assigned)</para>
                </xsl:otherwise>
              </xsl:choose>
              <para><xsl:value-of select="@doc" /></para>
            </listitem>
          </varlistentry>
        </xsl:for-each>
        </variablelist>
      </xsl:if>

      <!-- Print library specific attributes (if any) -->
      <xsl:if test="./vty:attributes[@scope='library']">
        <variablelist>
          <varlistentry>
            <listitem>
              <para>Library specific attributes</para>
            </listitem>
          </varlistentry>
        <xsl:for-each select="./vty:attributes[@scope='library']/*">
          <varlistentry>
            <listitem>
              <xsl:choose>
                <xsl:when test="@flag">
                  <para>Flag: <xsl:value-of select="@flag" /></para>
                </xsl:when>
                <xsl:otherwise>
                  <para>Flag: (not assigned)</para>
                </xsl:otherwise>
              </xsl:choose>
              <para><xsl:value-of select="@doc" /></para>
            </listitem>
          </varlistentry>
        </xsl:for-each>
        </variablelist>
      </xsl:if>

      <!-- Print application specific attributes (if any) -->
      <xsl:if test="./vty:attributes[@scope='application']">
        <variablelist>
          <varlistentry>
            <listitem>
              <para>Application specific attributes</para>
            </listitem>
          </varlistentry>
        <xsl:for-each select="./vty:attributes[@scope='application']/*">
          <varlistentry>
            <listitem>
              <xsl:choose>
                <xsl:when test="@flag">
                  <para>Flag: <xsl:value-of select="@flag" /></para>
                </xsl:when>
                <xsl:otherwise>
                  <para>Flag: (not assigned)</para>
                </xsl:otherwise>
              </xsl:choose>
              <para><xsl:value-of select="@doc" /></para>
            </listitem>
          </varlistentry>
        </xsl:for-each>
        </variablelist>
      </xsl:if>

        <variablelist>
          <varlistentry>
            <listitem>
              <para>Parameters</para>
            </listitem>
          </varlistentry>
        <xsl:for-each select="./vty:params/*">
          <varlistentry>
            <listitem>
              <para><xsl:value-of select="@name" /></para>
              <para><xsl:value-of select="@doc" /></para>
            </listitem>
          </varlistentry>
        </xsl:for-each>
        </variablelist>

      </section>
    </xsl:for-each>
</section>
  </xsl:template>
</xsl:transform>