Skip to content

Commit

Permalink
generate heading for sectioned examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Cooper committed Aug 18, 2018
1 parent 27f6af1 commit 1c33d61
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions xslt/generate-techniques.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,24 @@
</xsl:copy>
</xsl:template>

<xsl:template match="html:section[@class='example']">
<xsl:variable name="heading" select="wcag:find-heading(.)"/>
<xsl:variable name="heading-text">
<xsl:text>Example </xsl:text>
<xsl:value-of select="count(preceding-sibling::html:section[@class='example']) + 1"/>
<xsl:if test="normalize-space($heading) != ''">
<xsl:text>: </xsl:text>
<xsl:apply-templates select="$heading/node()"/>
</xsl:if>
</xsl:variable>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="id" select="wcag:generate-id($heading-text)"/>
<h3><xsl:copy-of select="$heading-text"/></h3>
<xsl:apply-templates select="html:*[not(wcag:isheading(.))]"/>
</xsl:copy>
</xsl:template>

<xsl:template match="html:section">
<xsl:copy>
<xsl:apply-templates select="@*"/>
Expand Down

0 comments on commit 1c33d61

Please sign in to comment.