configuration-wiki.xsl (12260B)
1 <?xml version="1.0" encoding="utf-8"?> 2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="2.0"> 3 <xsl:output method="html" indent="yes" omit-xml-declaration="yes" encoding="ISO-8859-1"/> 4 <xsl:param name="confdir" select="'/etc/vservers'"/> 5 <!-- set following parameter to anything else than 'true' to use a symbolic character to mark up file types --> 6 <xsl:param name="printstylename" select="'true'"/> 7 8 <xsl:template match="/database"> 9 <h1>The contents of the <xsl:value-of select="$confdir"/> directory</h1> 10 This page is automatically created by XSL transformation of configuration.xml. Additions, corrections, etc. should be made in that file, not in the Wiki page. 11 <xsl:choose> 12 <xsl:when test="$printstylename = 'true'"> 13 Directory names are written in <b>bold</b> letters. 14 15 Boolean files are files without content. Only existence matters. 16 17 Scalar files are files with only one line (one value). 18 19 List files are files with multiple values. One value per line. 20 21 Hash files are files with multiple key/value pairs. One key/value pair per line. 22 23 Symbolic names (variables) are written in <i>italic</i> letters. 24 </xsl:when> 25 <xsl:otherwise> 26 Directories are marked with a trailing / and <b>bold</b> letters. 27 28 Scripts are marked with a trailing superscript <sup>*</sup>. 29 30 Hash files (with key/value pairs) are marked with a trailing superscript <sup>#</sup>. 31 32 Boolean files (without content) are marked with a trailing superscript <sup>0</sup>. 33 34 Scalar files (with only one line) are marked with a trailing superscript <sup>1</sup>. 35 36 List files (with multiple lines) are marked with a trailing superscript <sup>min - max</sup> sequence, where min is the minimum and max the maximum number of lines. 37 38 Symlinks are marked with a trailing superscript <sup>@</sup>. 39 40 Data files have no special mark up. 41 42 Symbolic names (variables) are written in <i>italic</i> letters. 43 </xsl:otherwise> 44 </xsl:choose> 45 46 <xsl:call-template name="collection"> 47 <xsl:with-param name="thisdir"><xsl:value-of select="$confdir"/></xsl:with-param> 48 </xsl:call-template> 49 </xsl:template> 50 51 <xsl:template name="collection"> 52 <xsl:param name="thisdir"/> 53 <xsl:if test="count(scalar) + count(link) + count(program) + count(data) + count(hash) + count(list) + count(boolean) + count(collection)>0"> 54 <ul> 55 <xsl:if test="@id"><span><xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute></span></xsl:if> 56 <xsl:call-template name="dir-iterate"> 57 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 58 </xsl:call-template> 59 </ul> 60 </xsl:if> 61 </xsl:template> 62 63 <xsl:template name="dir-iterate"> 64 <xsl:param name="thisdir"/> 65 <xsl:apply-templates select="scalar|link|program|data|hash|list|boolean"> 66 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 67 <xsl:sort select="@name"/> 68 </xsl:apply-templates> 69 70 <xsl:apply-templates select="collection"> 71 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 72 <xsl:sort select="@name"/> 73 </xsl:apply-templates> 74 </xsl:template> 75 76 <xsl:template match="program"> 77 <xsl:param name="thisdir"/> 78 <li> 79 <xsl:call-template name="printname"> 80 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 81 <xsl:with-param name="style">script</xsl:with-param> 82 </xsl:call-template> 83 <xsl:call-template name="printcontent"/> 84 </li> 85 </xsl:template> 86 87 <xsl:template match="hash"> 88 <xsl:param name="thisdir"/> 89 <li> 90 <xsl:call-template name="printname"> 91 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 92 <xsl:with-param name="style">hash</xsl:with-param> 93 </xsl:call-template> 94 <xsl:call-template name="printcontent"/> 95 </li> 96 </xsl:template> 97 98 <xsl:template match="scalar"> 99 <xsl:param name="thisdir"/> 100 <li> 101 <xsl:call-template name="printname"> 102 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 103 <xsl:with-param name="style">file</xsl:with-param> 104 </xsl:call-template> 105 <xsl:call-template name="printcontent"/> 106 </li> 107 </xsl:template> 108 109 <xsl:template match="data"> 110 <xsl:param name="thisdir"/> 111 <li> 112 <xsl:call-template name="printname"> 113 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 114 <xsl:with-param name="style">data</xsl:with-param> 115 </xsl:call-template> 116 <xsl:call-template name="printcontent"/> 117 </li> 118 </xsl:template> 119 120 <xsl:template match="list"> 121 <xsl:param name="thisdir"/> 122 <li> 123 <xsl:call-template name="printname"> 124 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 125 <xsl:with-param name="style">list</xsl:with-param> 126 </xsl:call-template> 127 <xsl:call-template name="printcontent"/> 128 </li> 129 </xsl:template> 130 131 <xsl:template match="link"> 132 <xsl:param name="thisdir"/> 133 <li> 134 <xsl:call-template name="printname"> 135 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 136 <xsl:with-param name="style">symlink</xsl:with-param> 137 </xsl:call-template> 138 <xsl:call-template name="printcontent"/> 139 </li> 140 </xsl:template> 141 142 <xsl:template match="boolean"> 143 <xsl:param name="thisdir"/> 144 <li> 145 <xsl:call-template name="printname"> 146 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 147 <xsl:with-param name="style">boolean</xsl:with-param> 148 </xsl:call-template> 149 <xsl:call-template name="printcontent"/> 150 </li> 151 </xsl:template> 152 153 <xsl:template match="collection"> 154 <xsl:param name="thisdir"/> 155 <li> 156 <xsl:call-template name="printname"> 157 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/></xsl:with-param> 158 <xsl:with-param name="style">directory</xsl:with-param> 159 </xsl:call-template> 160 <xsl:call-template name="printcontent"/> 161 162 <xsl:call-template name="collection"> 163 <xsl:with-param name="thisdir"><xsl:value-of select="$thisdir"/>/<xsl:call-template name="printdirname"/></xsl:with-param> 164 </xsl:call-template> 165 </li> 166 </xsl:template> 167 168 <xsl:template match="collection" mode="printrpath"> 169 <xsl:text>/</xsl:text> 170 <span class="{@type}"> 171 <xsl:value-of select="@name"/> 172 </span> 173 </xsl:template> 174 175 <xsl:template name="printname"> 176 <xsl:param name="thisdir"/> 177 <xsl:param name="style"/> 178 <xsl:if test="@id"><span><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute></span></xsl:if> 179 <xsl:if test="$style = 'directory'">'''</xsl:if> 180 <xsl:value-of select="$thisdir"/>/<xsl:if test="@type = 'symbolic'">''</xsl:if><xsl:value-of select="@name"/><xsl:if test="@type = 'symbolic'">''</xsl:if> 181 <xsl:choose> 182 <xsl:when test="$printstylename = 'true'"> 183 <xsl:if test="$style = 'directory'">'''</xsl:if> 184 <xsl:value-of select="concat(' [',$style,']')"/> 185 </xsl:when> 186 <xsl:otherwise> 187 <xsl:choose> 188 <xsl:when test="$style = 'directory'">/'''</xsl:when> 189 <xsl:when test="$style = 'symlink'"><sup>@</sup></xsl:when> 190 <xsl:when test="$style = 'boolean'"><sup>0</sup></xsl:when> 191 <xsl:when test="$style = 'list'"><sup><xsl:choose> 192 <xsl:when test="minElements"><xsl:value-of select="minElements"/></xsl:when> 193 <xsl:otherwise>0</xsl:otherwise> 194 </xsl:choose><xsl:value-of select="0 + minElements"/>-<xsl:choose> 195 <xsl:when test="maxElements"><xsl:value-of select="maxElements"/></xsl:when> 196 <xsl:otherwise>∞</xsl:otherwise> 197 </xsl:choose></sup></xsl:when> 198 <xsl:when test="$style = 'file'"><sup>1</sup></xsl:when> 199 <xsl:when test="$style = 'script'"><sup>*</sup></xsl:when> 200 <xsl:when test="$style = 'hash'"><sup>#</sup></xsl:when> 201 <xsl:when test="$style = 'data'"></xsl:when> 202 <xsl:otherwise><sup>???</sup></xsl:otherwise> 203 </xsl:choose> 204 </xsl:otherwise> 205 </xsl:choose> 206 </xsl:template> 207 208 <xsl:template name="printcontent"> 209 <br/> 210 <xsl:apply-templates select="description"/> 211 <xsl:call-template name="since"/> 212 <xsl:apply-templates select="default"/> 213 <xsl:call-template name="default"/> 214 <xsl:if test="$printstylename = 'true'"> 215 <xsl:apply-templates select="minElements"/> 216 <xsl:apply-templates select="maxElements"/> 217 </xsl:if> 218 <xsl:apply-templates select="restriction"/> 219 <xsl:apply-templates select="elements"/> 220 <xsl:apply-templates select="parameterList"/> 221 <xsl:apply-templates select="keys"/> 222 </xsl:template> 223 224 <!-- Extra content for scalar nodes --> 225 226 <xsl:template match="restriction"> 227 <ul> 228 <ul> 229 Allowed values: 230 <xsl:apply-templates select="enumeration"> 231 <xsl:sort select="@value"/> 232 </xsl:apply-templates> 233 </ul> 234 </ul> 235 </xsl:template> 236 237 <xsl:template match="restriction/enumeration"> 238 <xsl:value-of select="concat(' ; ',@value)"/> 239 </xsl:template> 240 241 <!-- Extra content for hash nodes --> 242 243 <xsl:template match="keys"> 244 <ul> 245 <ul> 246 <xsl:apply-templates select="key"> 247 <xsl:sort select="@name"/> 248 </xsl:apply-templates> 249 </ul> 250 </ul> 251 </xsl:template> 252 253 <xsl:template match="keys/key"> 254 <xsl:value-of select="concat(' ; ',@name,' : ',replace(description,'[\r\n]+',' '))"/> 255 </xsl:template> 256 257 <!-- Extra content for list nodes --> 258 <xsl:template match="minElements"> 259 <ul> 260 <ul> 261 <xsl:value-of select="concat(' ; minimum number of Elements : ',replace('[\r\n]+',' '))"/> 262 </ul> 263 </ul> 264 </xsl:template> 265 266 <xsl:template match="maxElements"> 267 <ul> 268 <ul> 269 <xsl:value-of select="concat(' ; maximum number of Elements : ',replace('[\r\n]+',' '))"/> 270 </ul> 271 </ul> 272 </xsl:template> 273 274 <xsl:template match="elements"> 275 <ul> 276 <ul> 277 Possible values: 278 <xsl:apply-templates select="element"> 279 <xsl:sort select="@name"/> 280 </xsl:apply-templates> 281 </ul> 282 </ul> 283 </xsl:template> 284 285 <xsl:template match="elements/element"> 286 <xsl:value-of select="concat(' ; ',@name,' : ',replace(description,'[\r\n]+',' '))"/> 287 </xsl:template> 288 289 <!-- Extra content for program nodes --> 290 291 <xsl:template match="parameterList"> 292 <ul> 293 <ul> 294 Will be called with the following parameters: 295 <xsl:apply-templates select="parameter"/> 296 </ul> 297 </ul> 298 </xsl:template> 299 300 <xsl:template match="parameterList/parameter"> 301 <xsl:value-of select="concat(' ; ',@name,' : ',replace(description,'[\r\n]+',' '))"/> 302 </xsl:template> 303 304 <!-- Extra content for all nodes --> 305 306 <xsl:template match="default"> 307 <ul><ul><xsl:value-of select="concat(' ; Default : ',replace(.,'[\r\n]+',' '))"/></ul></ul> 308 </xsl:template> 309 310 <xsl:template name="default"><xsl:if test="@default"> 311 <ul><ul> ; Default : <xsl:value-of select="@default"/></ul></ul> 312 </xsl:if></xsl:template>" 313 314 <xsl:template name="since"><xsl:if test="@since"> 315 <ul><ul> ; Since Version : <xsl:value-of select="@since"/></ul></ul> 316 </xsl:if></xsl:template> 317 318 <!-- --> 319 320 <xsl:template name="printdirname"><xsl:if test="@type='symbolic'">''</xsl:if><xsl:value-of select="@name"/><xsl:if test="@type='symbolic'">''</xsl:if></xsl:template> 321 <xsl:template match="description"><xsl:apply-templates/></xsl:template> 322 <xsl:template match="ulink">[<xsl:value-of select="@url"/><xsl:value-of select="concat(' ',replace(.,'[\r\n]+',' '))"/>]</xsl:template> 323 <xsl:template match="br"><br /></xsl:template> 324 <xsl:template match="p"><div><xsl:apply-templates/></div></xsl:template> 325 <xsl:template match="tool"><code><xsl:apply-templates/></code></xsl:template> 326 <xsl:template match="command"><code><xsl:apply-templates/></code></xsl:template> 327 <xsl:template match="directory"><xsl:apply-templates/></xsl:template> 328 <xsl:template match="optionref">[[#<xsl:choose> 329 <xsl:when test="@ref"><xsl:value-of select="@ref"/></xsl:when> 330 <xsl:otherwise><xsl:apply-templates/></xsl:otherwise> 331 </xsl:choose>|<xsl:apply-templates/>]]</xsl:template> 332 333 <xsl:template match="filename">[file://<xsl:value-of select="text()"/>]</xsl:template> 334 335 </xsl:stylesheet>