Use XSL to generate man page from the rules XML
[xorg/xkeyboard-config] / xslt / man.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" 
3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4   >
5 <xsl:output method="text" encoding="UTF-8" doctype-system="xkb.dtd"/>
6 <xsl:template match="/xkbConfigRegistry"><![CDATA[.\" WARNING: this man page is autogenerated. Do not edit or you will lose all your changes.
7 .TH XKEYBOARD-CONFIG __miscmansuffix__ __vendorversion__
8 .SH NAME
9 xkeyboard-config \- XKB data description files
10 .SH DESCRIPTION
11 xkeyboard-config provides the description files for the X Keyboard
12 Extension (XKB). The configuration options below are usually applied with
13 setxkbmap.
14 .SH MODELS
15 .TS
16 l l
17 ___
18 lB l.
19 model   description ]]>
20 <xsl:apply-templates select="modelList"/>
21 <![CDATA[
22 .TE
23 .SH LAYOUTS
24 .TS
25 l l l
26 ____
27 lB lB l.
28 layout  variant description ]]>
29 <xsl:apply-templates select="layoutList"/>
30 <![CDATA[
31 .TE
32 .SH OPTIONS
33 ]]>
34 <xsl:apply-templates select="optionList"/>
35 <![CDATA[
36 .SH SEE ALSO
37 setxkbmap(__appmansuffix__)
38 ]]>
39 </xsl:template>
40
41 <!-- split model/description into a normal table -->
42 <xsl:template match="modelList">
43     <xsl:for-each select="model">
44         <xsl:value-of select="configItem/name"/><xsl:text>      </xsl:text><xsl:value-of select="configItem/description"/>
45 <xsl:text>
46 </xsl:text>
47 </xsl:for-each>
48 </xsl:template>
49
50 <!-- split layout/variant/description into a table like this
51
52         layout1                 description
53                 variant1        description
54                 variant2        description
55         layout2                 description
56                 variant1        description
57 -->
58 <xsl:template match="layoutList">
59 <xsl:for-each select="layout">
60 <xsl:value-of select="configItem/name"/><xsl:text>              </xsl:text><xsl:value-of select="configItem/description"/>
61 <xsl:text>
62 </xsl:text>
63 <xsl:for-each select="variantList/variant">
64 <xsl:text>      </xsl:text><xsl:value-of select="configItem/name"/><xsl:text>   </xsl:text><xsl:value-of select="configItem/description"/>
65 <xsl:text>
66 </xsl:text>
67 </xsl:for-each>
68 <xsl:text>
69 </xsl:text>
70 </xsl:for-each>
71 </xsl:template>
72
73 <!-- split option into a table like this
74
75 option description:
76         optarg          description
77         optarg          description
78         optarg          description
79
80 option2 description:
81         optarg          description
82         optarg          description
83 -->
84 <xsl:template match="optionList">
85 <xsl:for-each select="group">
86 <![CDATA[
87 .SS]]> <xsl:value-of select="configItem/description"/>
88 <![CDATA[
89 .BR
90 .TS
91 l l
92 ___
93 lB l.
94 option  description ]]>
95 <xsl:for-each select="option">
96 <xsl:value-of select="configItem/name"/><xsl:text>      </xsl:text><xsl:value-of select="configItem/description"/>
97 <xsl:text>
98 </xsl:text>
99 </xsl:for-each>
100 <![CDATA[
101 .TE
102
103 ]]>
104 </xsl:for-each>
105 </xsl:template>
106 </xsl:stylesheet>