| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
| 4 |
|
| 5 |
<xsl:template match="/"> |
| 6 |
<document> |
| 7 |
<xsl:apply-templates select="*/node()"/> |
| 8 |
</document> |
| 9 |
</xsl:template> |
| 10 |
|
| 11 |
<xsl:template match="*"> |
| 12 |
<xsl:copy> |
| 13 |
<xsl:copy-of select="@*"/> |
| 14 |
<xsl:apply-templates select="node()"/> |
| 15 |
</xsl:copy> |
| 16 |
</xsl:template> |
| 17 |
|
| 18 |
<xsl:template match="tests"> |
| 19 |
<table class="tests"> |
| 20 |
<tr class="tests-header"> |
| 21 |
<td rowspan="{count(test) + 1}"> |
| 22 |
<xsl:attribute name="class"> |
| 23 |
<xsl:text>vertical-bar </xsl:text> |
| 24 |
<xsl:choose> |
| 25 |
<xsl:when test="@status"><xsl:value-of select="@status"/></xsl:when> |
| 26 |
<xsl:when test="yes">yes</xsl:when> |
| 27 |
<xsl:when test="partial">partial</xsl:when> |
| 28 |
<xsl:when test="no">no</xsl:when> |
| 29 |
<xsl:when test="not(*/yes) and not(*/partial) and */no">no</xsl:when> |
| 30 |
<xsl:when test="*/partial or */partial and */no or */yes and */no">partial</xsl:when> |
| 31 |
<xsl:otherwise>yes</xsl:otherwise> |
| 32 |
</xsl:choose> |
| 33 |
</xsl:attribute> |
| 34 |
</td> |
| 35 |
<th> |
| 36 |
SVG 1.1 test suite |
| 37 |
</th> |
| 38 |
<th/> |
| 39 |
<th/> |
| 40 |
</tr> |
| 41 |
<xsl:if test="notes"> |
| 42 |
<tr class="section-note"> |
| 43 |
<td></td> |
| 44 |
<td></td> |
| 45 |
<td> |
| 46 |
<xsl:apply-templates select="notes"/> |
| 47 |
</td> |
| 48 |
</tr> |
| 49 |
</xsl:if> |
| 50 |
<xsl:apply-templates> |
| 51 |
<xsl:sort select="@name"/> |
| 52 |
</xsl:apply-templates> |
| 53 |
</table> |
| 54 |
</xsl:template> |
| 55 |
|
| 56 |
<xsl:template match="elements | interfaces"> |
| 57 |
<table class="elements"> |
| 58 |
<xsl:apply-templates> |
| 59 |
<xsl:sort select="@ns"/> |
| 60 |
<xsl:sort select="@name"/> |
| 61 |
</xsl:apply-templates> |
| 62 |
</table> |
| 63 |
</xsl:template> |
| 64 |
|
| 65 |
<xsl:template match="object"> |
| 66 |
<div class="object"> |
| 67 |
<div class="object-header"> |
| 68 |
<xsl:value-of select="@name"/> |
| 69 |
</div> |
| 70 |
<xsl:if test="prop"> |
| 71 |
<div class="object-section-header">Properties</div> |
| 72 |
<xsl:apply-templates select="prop"> |
| 73 |
<xsl:sort select="@name"/> |
| 74 |
</xsl:apply-templates> |
| 75 |
</xsl:if> |
| 76 |
<xsl:if test="func"> |
| 77 |
<div class="object-section-header">Function properties</div> |
| 78 |
<xsl:apply-templates select="func"> |
| 79 |
<xsl:sort select="@name"/> |
| 80 |
</xsl:apply-templates> |
| 81 |
</xsl:if> |
| 82 |
</div> |
| 83 |
</xsl:template> |
| 84 |
|
| 85 |
<xsl:template match="object/prop"> |
| 86 |
<div class="object-property-header"> |
| 87 |
<xsl:value-of select="@name"/> |
| 88 |
</div> |
| 89 |
<div class="object-property-desc"> |
| 90 |
<xsl:apply-templates/> |
| 91 |
</div> |
| 92 |
</xsl:template> |
| 93 |
|
| 94 |
<xsl:template match="object/func"> |
| 95 |
<div class="object-property-header"> |
| 96 |
<xsl:value-of select="@name"/> |
| 97 |
<span class="object-property-func-params"> |
| 98 |
<xsl:text>(</xsl:text> |
| 99 |
<xsl:value-of select="@params"/> |
| 100 |
<xsl:text>)</xsl:text> |
| 101 |
</span> |
| 102 |
</div> |
| 103 |
<div class="object-property-desc"> |
| 104 |
<xsl:apply-templates/> |
| 105 |
</div> |
| 106 |
</xsl:template> |
| 107 |
|
| 108 |
<xsl:template match="element | interface"> |
| 109 |
<tr class="element-header"> |
| 110 |
<td rowspan="{count(attr | prop | op) + number(boolean(attr)) + number(boolean(prop)) + number(boolean(op)) + number(boolean(notes))+ 1}"> |
| 111 |
<xsl:attribute name="class"> |
| 112 |
<xsl:text>vertical-bar </xsl:text> |
| 113 |
<xsl:choose> |
| 114 |
<xsl:when test="@status"><xsl:value-of select="@status"/></xsl:when> |
| 115 |
<xsl:when test="yes">yes</xsl:when> |
| 116 |
<xsl:when test="partial">partial</xsl:when> |
| 117 |
<xsl:when test="no">no</xsl:when> |
| 118 |
<xsl:when test="not(*/yes) and not(*/partial) and */no">no</xsl:when> |
| 119 |
<xsl:when test="*/partial or */partial and */no or */yes and */no">partial</xsl:when> |
| 120 |
<xsl:otherwise>yes</xsl:otherwise> |
| 121 |
</xsl:choose> |
| 122 |
</xsl:attribute> |
| 123 |
</td> |
| 124 |
<th> |
| 125 |
<xsl:variable name="element-name"> |
| 126 |
<xsl:call-template name="qname"> |
| 127 |
<xsl:with-param name="name" select="@name"/> |
| 128 |
<xsl:with-param name="ns" select="string(@ns)"/> |
| 129 |
<xsl:with-param name="prefixes" select="../prefixes"/> |
| 130 |
</xsl:call-template> |
| 131 |
</xsl:variable> |
| 132 |
<a name="{$element-name}"/> |
| 133 |
<xsl:value-of select="$element-name"/> |
| 134 |
</th> |
| 135 |
<th/> |
| 136 |
<th/> |
| 137 |
</tr> |
| 138 |
<xsl:if test="notes"> |
| 139 |
<tr class="section-note"> |
| 140 |
<td></td> |
| 141 |
<td></td> |
| 142 |
<td> |
| 143 |
<xsl:apply-templates select="notes"/> |
| 144 |
</td> |
| 145 |
</tr> |
| 146 |
</xsl:if> |
| 147 |
<xsl:if test="attr"> |
| 148 |
<tr class="section-header"> |
| 149 |
<th colspan="3">Attributes</th> |
| 150 |
</tr> |
| 151 |
<xsl:apply-templates select="attr"> |
| 152 |
<xsl:sort select="@ns"/> |
| 153 |
<xsl:sort select="@name"/> |
| 154 |
</xsl:apply-templates> |
| 155 |
</xsl:if> |
| 156 |
<xsl:if test="prop"> |
| 157 |
<tr class="section-header"> |
| 158 |
<th colspan="3">Properties</th> |
| 159 |
</tr> |
| 160 |
<xsl:apply-templates select="prop"/> |
| 161 |
</xsl:if> |
| 162 |
<xsl:if test="op"> |
| 163 |
<tr class="section-header"> |
| 164 |
<th colspan="3">Operations</th> |
| 165 |
</tr> |
| 166 |
<xsl:apply-templates select="op"/> |
| 167 |
</xsl:if> |
| 168 |
</xsl:template> |
| 169 |
|
| 170 |
<xsl:template match="attr | element/prop | op | test"> |
| 171 |
<tr class="attribute"> |
| 172 |
<th class="attribute-name"> |
| 173 |
<xsl:choose> |
| 174 |
<xsl:when test="local-name() = 'attr' and parent::element"> |
| 175 |
<xsl:call-template name="qname"> |
| 176 |
<xsl:with-param name="name" select="@name"/> |
| 177 |
<xsl:with-param name="ns" select="@ns"/> |
| 178 |
<xsl:with-param name="prefixes" select="../../prefixes"/> |
| 179 |
</xsl:call-template> |
| 180 |
</xsl:when> |
| 181 |
<xsl:when test='self::test'> |
| 182 |
<a href='{../@uri}{@name}.svg'><xsl:value-of select='@name'/></a> |
| 183 |
</xsl:when> |
| 184 |
<xsl:otherwise> |
| 185 |
<xsl:value-of select="@name"/> |
| 186 |
</xsl:otherwise> |
| 187 |
</xsl:choose> |
| 188 |
</th> |
| 189 |
<xsl:choose> |
| 190 |
<xsl:when test="yes"><td class="yes">yes</td></xsl:when> |
| 191 |
<xsl:when test="partial"><td class="partial">partial</td></xsl:when> |
| 192 |
<xsl:otherwise><td class="no">no</td></xsl:otherwise> |
| 193 |
</xsl:choose> |
| 194 |
<td class="attribute-note"> |
| 195 |
<xsl:apply-templates select="*/node()"/> |
| 196 |
</td> |
| 197 |
</tr> |
| 198 |
</xsl:template> |
| 199 |
|
| 200 |
<xsl:template match="prefixes"/> |
| 201 |
|
| 202 |
<xsl:template name="qname"> |
| 203 |
<xsl:param name="name"/> |
| 204 |
<xsl:param name="ns"/> |
| 205 |
<xsl:param name="prefixes"/> |
| 206 |
<xsl:choose> |
| 207 |
<xsl:when test="$ns = ''"> |
| 208 |
<xsl:value-of select="$name"/> |
| 209 |
</xsl:when> |
| 210 |
<xsl:otherwise> |
| 211 |
<xsl:variable name="prefix" select="$prefixes/prefix[@ns=$ns][1]/@prefix"/> |
| 212 |
<xsl:choose> |
| 213 |
<xsl:when test="$prefix = ''"> |
| 214 |
<xsl:value-of select="concat('{', $ns, '}', $name)"/> |
| 215 |
</xsl:when> |
| 216 |
<xsl:otherwise> |
| 217 |
<xsl:value-of select="concat($prefix, ':', $name)"/> |
| 218 |
</xsl:otherwise> |
| 219 |
</xsl:choose> |
| 220 |
</xsl:otherwise> |
| 221 |
</xsl:choose> |
| 222 |
</xsl:template> |
| 223 |
|
| 224 |
<xsl:template match="yes | partial | no"> |
| 225 |
<span class="{local-name()}"><xsl:apply-templates/></span> |
| 226 |
</xsl:template> |
| 227 |
</xsl:stylesheet> |