[3.1.0] Feature parity with configdoc rewrite
[htmlpurifier.git] / configdoc / styles / plain.xsl
blob2897be2ffd053f253492f3b641b9beb5aefd14e5
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet
3 version = "1.0"
4 xmlns = "http://www.w3.org/1999/xhtml"
5 xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
7 <xsl:output
8 method = "xml"
9 encoding = "UTF-8"
10 doctype-public = "-//W3C//DTD XHTML 1.0 Transitional//EN"
11 doctype-system = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
12 indent = "no"
13 media-type = "text/html"
15 <xsl:param name="css" select="'styles/plain.css'"/>
16 <xsl:param name="title" select="'Configuration Documentation'"/>
18 <xsl:variable name="typeLookup" select="document('../types.xml')" />
20 <xsl:template match="/">
21 <html lang="en" xml:lang="en">
22 <head>
23 <title><xsl:value-of select="$title" /> - <xsl:value-of select="/configdoc/title" /></title>
24 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
25 <link rel="stylesheet" type="text/css" href="{$css}" />
26 </head>
27 <body>
28 <div id="library"><xsl:value-of select="/configdoc/title" /></div>
29 <h1><xsl:value-of select="$title" /></h1>
30 <h2>Table of Contents</h2>
31 <ul id="toc">
32 <xsl:apply-templates mode="toc" />
33 </ul>
34 <xsl:apply-templates />
35 </body>
36 </html>
37 </xsl:template>
39 <xsl:template match="title" mode="toc" />
40 <xsl:template match="namespace" mode="toc">
41 <xsl:if test="count(directive)&gt;0">
42 <li>
43 <a href="#{@id}"><xsl:value-of select="name" /></a>
44 <ul>
45 <xsl:apply-templates select="directive" mode="toc" />
46 </ul>
47 </li>
48 </xsl:if>
49 </xsl:template>
50 <xsl:template match="directive" mode="toc">
51 <li><a href="#{@id}"><xsl:value-of select="name" /></a></li>
52 </xsl:template>
54 <xsl:template match="title" />
56 <xsl:template match="namespace">
57 <xsl:apply-templates />
58 <xsl:if test="count(directive)=0">
59 <p>No configuration directives defined for this namespace.</p>
60 </xsl:if>
61 </xsl:template>
62 <xsl:template match="namespace/name">
63 <h2 id="{../@id}"><xsl:value-of select="." /></h2>
64 </xsl:template>
65 <xsl:template match="namespace/description">
66 <div class="description">
67 <xsl:copy-of xmlns:xhtml="http://www.w3.org/1999/xhtml" select="xhtml:div/node()" />
68 </div>
69 </xsl:template>
71 <xsl:template match="directive">
72 <xsl:apply-templates />
73 </xsl:template>
74 <xsl:template match="directive/name">
75 <xsl:apply-templates select="../aliases/alias" mode="anchor" />
76 <h3 id="{../@id}"><xsl:value-of select="../@id" /></h3>
77 </xsl:template>
78 <xsl:template match="alias" mode="anchor">
79 <a id="{.}"></a>
80 </xsl:template>
82 <!-- Do not pass through -->
83 <xsl:template match="alias"></xsl:template>
85 <xsl:template match="directive/constraints">
86 <table class="constraints">
87 <xsl:apply-templates />
88 <xsl:if test="../aliases/alias">
89 <xsl:apply-templates select="../aliases" mode="constraints" />
90 </xsl:if>
91 </table>
92 </xsl:template>
93 <xsl:template match="directive/aliases" mode="constraints">
94 <tr>
95 <th>Aliases:</th>
96 <td>
97 <xsl:for-each select="alias">
98 <xsl:if test="position()&gt;1">, </xsl:if>
99 <xsl:value-of select="." />
100 </xsl:for-each>
101 </td>
102 </tr>
103 </xsl:template>
104 <xsl:template match="directive/description">
105 <div class="description">
106 <xsl:copy-of xmlns:xhtml="http://www.w3.org/1999/xhtml" select="xhtml:div/node()" />
107 </div>
108 </xsl:template>
110 <xsl:template match="constraints/type">
111 <tr>
112 <th>Type:</th>
113 <td>
114 <xsl:variable name="type" select="text()" />
115 <xsl:attribute name="class">type type-<xsl:value-of select="$type" /></xsl:attribute>
116 <xsl:value-of select="$typeLookup/types/type[@id=$type]/text()" />
117 <xsl:if test="@allow-null='yes'">
118 (or null)
119 </xsl:if>
120 </td>
121 </tr>
122 </xsl:template>
123 <xsl:template match="constraints/allowed">
124 <tr>
125 <th>Allowed values:</th>
126 <td>
127 <xsl:for-each select="value"><!--
128 --><xsl:if test="position()&gt;1">, </xsl:if>
129 &quot;<xsl:value-of select="." />&quot;<!--
130 --></xsl:for-each>
131 </td>
132 </tr>
133 </xsl:template>
134 <xsl:template match="constraints/default">
135 <tr>
136 <th>Default:</th>
137 <td><pre><xsl:value-of select="." xml:space="preserve" /></pre></td>
138 </tr>
139 </xsl:template>
141 </xsl:stylesheet>