forked from w3c/wcag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-techniques-toc.xslt
57 lines (50 loc) · 2.29 KB
/
generate-techniques-toc.xslt
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wcag="https://www.w3.org/WAI/GL/"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="#all"
version="2.0">
<xsl:import href="base.xslt"/>
<xsl:output method="xhtml" indent="yes" omit-xml-declaration="yes" encoding="UTF-8"/>
<xsl:template match="techniques">
<xsl:result-document href="toc.html" method="xhtml" omit-xml-declaration="yes">
<xsl:apply-templates select="technology">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:result-document>
</xsl:template>
<xsl:template match="technology">
<xsl:variable name="technology-id" select="wcag:generate-id(@name)"/>
<xsl:variable name="technology-title">
<xsl:choose>
<xsl:when test="@name = 'aria'">ARIA Techniques</xsl:when>
<xsl:when test="@name = 'client-side-script'">Client-Side Script Techniques</xsl:when>
<xsl:when test="@name = 'css'">CSS Techniques</xsl:when>
<xsl:when test="@name = 'failures'">Common Failures</xsl:when>
<xsl:when test="@name = 'flash'">Flash Techniques</xsl:when>
<xsl:when test="@name = 'general'">General Techniques</xsl:when>
<xsl:when test="@name = 'html'">HTML Techniques</xsl:when>
<xsl:when test="@name = 'pdf'">PDF Techniques</xsl:when>
<xsl:when test="@name = 'server-side-script'">Server-Side Script Techniques</xsl:when>
<xsl:when test="@name = 'silverlight'">Silverlight Techniques</xsl:when>
<xsl:when test="@name = 'smil'">SMIL Techniques</xsl:when>
<xsl:when test="@name = 'text'">Plain-Text Techniques</xsl:when>
</xsl:choose>
</xsl:variable>
<h2 id="{$technology-id}">
<xsl:value-of select="$technology-title"/>
<span class="permalink"><a href="#{$technology-id}" aria-label="Permalink for {$technology-title}" title="Permalink for {$technology-title}"><span>§</span></a></span>
</h2>
<ul class="toc-wcag-docs">
<xsl:apply-templates select="technique">
<xsl:sort select="wcag:number-in-id(@id)" data-type="number"/>
</xsl:apply-templates>
</ul>
</xsl:template>
<xsl:template match="technique">
<li>
<a href="{parent::technology/@name}/{@id}"><xsl:value-of select="@id"/>: <xsl:value-of select="title"/></a>
</li>
</xsl:template>
</xsl:stylesheet>