File: xml-usage-to-docbook.xsl

package info (click to toggle)
drbd-utils 9.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,388 kB
  • sloc: ansic: 43,698; xml: 15,968; cpp: 7,783; sh: 3,699; makefile: 1,353; perl: 353
file content (58 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download | duplicates (15)
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <cmdsynopsis sepchar=" ">
      <command moreinfo="none">drbdsetup</command>
      <xsl:apply-templates select="command"/>
    </cmdsynopsis>
  </xsl:template>

  <xsl:template match="command">
    <arg choice="plain" rep="norepeat">
      <xsl:value-of select="@name"/>
    </arg>
    <xsl:apply-templates select="argument|group"/>
    <xsl:apply-templates select="option"/>
  </xsl:template>

  <xsl:template match="group">
    <group choice="req">
      <xsl:apply-templates/>
    </group>
  </xsl:template>

  <xsl:template match="argument">
    <arg choice="plain" rep="norepeat">
      <replaceable><xsl:value-of select="."/></replaceable>
    </arg>
  </xsl:template>

  <xsl:template match="option[@type = 'numeric'] | option[@type='string']">
    <arg choice="opt" rep="norepeat">
      <xsl:text>--</xsl:text>
      <xsl:value-of select="@name"/>
      <xsl:text> </xsl:text>
      <arg choice="req" rep="norepeat"><replaceable>val</replaceable></arg>
    </arg>
  </xsl:template>

  <xsl:template match="option[@type = 'handler']">
    <arg choice="opt" rep="norepeat">--<xsl:value-of select="@name"/>
      <group choice="req" rep="norepeat">
	<xsl:apply-templates select="handler"/>
      </group>
    </arg>
  </xsl:template>

  <xsl:template match="option[@type = 'boolean']">
    <arg choice="opt" rep="norepeat">--<xsl:value-of select="@name"/></arg>
  </xsl:template>

  <xsl:template match="handler">
    <arg choice="plain" rep="norepeat">
      <xsl:value-of select="."/>
    </arg>
  </xsl:template>

</xsl:stylesheet>