|
91 | 91 | </xsl:choose>
|
92 | 92 | </xsl:template>
|
93 | 93 |
|
| 94 | +<!-- Generic template for handling accessibility properties --> |
| 95 | +<xsl:template name="get.accessibility.property.xml"> |
| 96 | + <xsl:param name="terms.to.process" select="''"/> |
| 97 | + <xsl:param name="property.type" select="'term'"/> <!-- 'term', 'feature', or 'hazard' --> |
| 98 | + <xsl:param name="first.call" select="1"/> |
| 99 | + <xsl:choose> |
| 100 | + <xsl:when test="$first.call = 1"> |
| 101 | + <xsl:variable name="wrapper.element"> |
| 102 | + <xsl:choose> |
| 103 | + <xsl:when test="$property.type = 'term'">e:accessibility-terms</xsl:when> |
| 104 | + <xsl:when test="$property.type = 'feature'">e:accessibility-features</xsl:when> |
| 105 | + <xsl:when test="$property.type = 'hazard'">e:accessibility-hazards</xsl:when> |
| 106 | + </xsl:choose> |
| 107 | + </xsl:variable> |
| 108 | + <xsl:element name="{$wrapper.element}"> |
| 109 | + <xsl:call-template name="get.accessibility.property.xml"> |
| 110 | + <xsl:with-param name="terms.to.process" select="$terms.to.process"/> |
| 111 | + <xsl:with-param name="property.type" select="$property.type"/> |
| 112 | + <xsl:with-param name="first.call" select="0"/> |
| 113 | + </xsl:call-template> |
| 114 | + </xsl:element> |
| 115 | + </xsl:when> |
| 116 | + <xsl:otherwise> |
| 117 | + <xsl:choose> |
| 118 | + <xsl:when test="normalize-space(substring-before($terms.to.process, '
')) != ''"> |
| 119 | + <xsl:variable name="term"> |
| 120 | + <xsl:value-of select="normalize-space(substring-before($terms.to.process, '
'))"/> |
| 121 | + </xsl:variable> |
| 122 | + <xsl:variable name="element.name"> |
| 123 | + <xsl:choose> |
| 124 | + <xsl:when test="$property.type = 'term'">e:term</xsl:when> |
| 125 | + <xsl:when test="$property.type = 'feature'">e:feature</xsl:when> |
| 126 | + <xsl:when test="$property.type = 'hazard'">e:hazard</xsl:when> |
| 127 | + </xsl:choose> |
| 128 | + </xsl:variable> |
| 129 | + <xsl:element name="{$element.name}"><xsl:value-of select="$term"/></xsl:element> |
| 130 | + <xsl:if test="normalize-space(substring-after($terms.to.process, '
')) != ''"> |
| 131 | + <xsl:call-template name="get.accessibility.property.xml"> |
| 132 | + <xsl:with-param name="terms.to.process" select="substring-after($terms.to.process, '
')"/> |
| 133 | + <xsl:with-param name="property.type" select="$property.type"/> |
| 134 | + <xsl:with-param name="first.call" select="0"/> |
| 135 | + </xsl:call-template> |
| 136 | + </xsl:if> |
| 137 | + </xsl:when> |
| 138 | + <xsl:when test="normalize-space($terms.to.process) != ''"> |
| 139 | + <xsl:variable name="term"> |
| 140 | + <xsl:value-of select="normalize-space($terms.to.process)"/> |
| 141 | + </xsl:variable> |
| 142 | + <xsl:variable name="element.name"> |
| 143 | + <xsl:choose> |
| 144 | + <xsl:when test="$property.type = 'term'">e:term</xsl:when> |
| 145 | + <xsl:when test="$property.type = 'feature'">e:feature</xsl:when> |
| 146 | + <xsl:when test="$property.type = 'hazard'">e:hazard</xsl:when> |
| 147 | + </xsl:choose> |
| 148 | + </xsl:variable> |
| 149 | + <xsl:element name="{$element.name}"><xsl:value-of select="$term"/></xsl:element> |
| 150 | + </xsl:when> |
| 151 | + </xsl:choose> |
| 152 | + </xsl:otherwise> |
| 153 | + </xsl:choose> |
| 154 | +</xsl:template> |
| 155 | + |
| 156 | +<!-- Parameter for accessibility modes --> |
| 157 | +<xsl:variable name="accessibility.modes.list.xml"> |
| 158 | + <xsl:call-template name="get.accessibility.property.xml"> |
| 159 | + <xsl:with-param name="terms.to.process" select="$access.mode"/> |
| 160 | + <xsl:with-param name="property.type" select="'term'"/> |
| 161 | + </xsl:call-template> |
| 162 | +</xsl:variable> |
| 163 | + |
| 164 | +<!-- Parameter for accessibility mode sufficient --> |
| 165 | +<xsl:variable name="accessibility.mode.sufficient.list.xml"> |
| 166 | + <xsl:call-template name="get.accessibility.property.xml"> |
| 167 | + <xsl:with-param name="terms.to.process" select="$access.mode.sufficient"/> |
| 168 | + <xsl:with-param name="property.type" select="'term'"/> |
| 169 | + </xsl:call-template> |
| 170 | +</xsl:variable> |
| 171 | + |
| 172 | +<!-- Parameter for accessibility features --> |
| 173 | +<xsl:variable name="accessibility.features.list.xml"> |
| 174 | + <xsl:call-template name="get.accessibility.property.xml"> |
| 175 | + <xsl:with-param name="terms.to.process" select="$accessibility.feature"/> |
| 176 | + <xsl:with-param name="property.type" select="'feature'"/> |
| 177 | + </xsl:call-template> |
| 178 | +</xsl:variable> |
| 179 | + |
| 180 | +<!-- Parameter for accessibility hazards --> |
| 181 | +<xsl:variable name="accessibility.hazards.list.xml"> |
| 182 | + <xsl:call-template name="get.accessibility.property.xml"> |
| 183 | + <xsl:with-param name="terms.to.process" select="$accessibility.hazard"/> |
| 184 | + <xsl:with-param name="property.type" select="'hazard'"/> |
| 185 | + </xsl:call-template> |
| 186 | +</xsl:variable> |
| 187 | + |
94 | 188 | <xsl:template name="generate.mimetype">
|
95 | 189 | <!-- Outputs "mimetype" file that meets EPUB 3.0 specifications: http://www.idpf.org/epub/30/spec/epub30-ocf.html#physical-container-zip-->
|
96 | 190 | <!-- Override this template if you want to customize mimetype output -->
|
|
379 | 473 | <xsl:if test="$metadata.ibooks-specified-fonts = 1">
|
380 | 474 | <meta property="ibooks:specified-fonts">true</meta>
|
381 | 475 | </xsl:if>
|
| 476 | + |
| 477 | + <!-- Generate schema:accessMode elements for each term --> |
| 478 | + <xsl:for-each select="exsl:node-set($accessibility.modes.list.xml)//e:term"> |
| 479 | + <meta property="schema:accessMode"><xsl:value-of select="."/></meta> |
| 480 | + </xsl:for-each> |
| 481 | + |
| 482 | + <!-- Generate schema:accessModeSufficient elements for each term --> |
| 483 | + <xsl:for-each select="exsl:node-set($accessibility.mode.sufficient.list.xml)//e:term"> |
| 484 | + <meta property="schema:accessModeSufficient"><xsl:value-of select="."/></meta> |
| 485 | + </xsl:for-each> |
| 486 | + |
| 487 | + <!-- Generate schema:accessibilityFeature elements for each feature --> |
| 488 | + <xsl:for-each select="exsl:node-set($accessibility.features.list.xml)//e:feature"> |
| 489 | + <meta property="schema:accessibilityFeature"><xsl:value-of select="."/></meta> |
| 490 | + </xsl:for-each> |
| 491 | + |
| 492 | + <!-- Generate schema:accessibilityHazard elements for each feature --> |
| 493 | + <xsl:for-each select="exsl:node-set($accessibility.hazards.list.xml)//e:hazard"> |
| 494 | + <meta property="schema:accessibilityHazard"><xsl:value-of select="."/></meta> |
| 495 | + </xsl:for-each> |
382 | 496 | </metadata>
|
383 | 497 | </xsl:template>
|
384 | 498 |
|
|
0 commit comments