6. Stylesheet for the XHTML Structural Module

xsl:stylesheet id="stylesheet" exclude-result-prefixes="x2 lit xs" version="1.0" xml:lang="en"

xsl:key name="numbers" match="xs:number" use="@href"

address
blockcode
blockquote
div
h
p
pre
section
separator

xsl:template match="x2:address" id="address"
  xsl:call-template name="copy-xhtml1"
xsl:template match="x2:blockcode" id="blockcode"
  xsl:call-template name="copy-xhtml1"
    xsl:with-param name="tag-name" select="'pre'"
  
xsl:template match="x2:blockquote" id="blockquote"
  xsl:call-template name="copy-xhtml1"
xsl:template match="x2:div" id="div"
  xsl:call-template name="copy-xhtml1"
xsl:template match="x2:pre" id="pre"
  xsl:call-template name="copy-xhtml1"
xsl:template match="x2:section" id="section"
  xsl:call-template name="copy-xhtml1"
    xsl:with-param name="tag-name" select="'div'"
    xsl:with-param name="content"
      xsl:apply-templates select="child::x2:h" mode="heading"
      <div>
        xsl:attribute name="id"
          xsl:call-template name="id"
            xsl:with-param name="suffix" select="'.content'"
          
        

        xsl:apply-templates
      </div>
    
  
xsl:template match="x2:separator" id="separator"
  xsl:call-template name="copy-xhtml1"
    xsl:with-param name="tag-name" select="'hr'"
  
xsl:template match="x2:p" id="p"
  xsl:call-template name="copy-xhtml1"

xsl:template match="x2:h"


xsl:template match="x2:h" mode="heading"
  xsl:variable name="level" select="count(ancestor::x2:section)"
  xsl:element name="{concat('h', $level)}" namespace="http://www.w3.org/1999/xhtml"

    xsl:variable name="content-id"
      xsl:call-template name="id"
        xsl:with-param name="target" select=".."
        xsl:with-param name="suffix" select="'.content'"
      
    

    <a href="{concat('#', $content-id)}" class="hiding-switch">
      xsl:attribute name="onclick"
        xsl:textreturn hiding_switch('
        xsl:value-of select="$content-id"
        xsl:text', event)
      
      xsl:text▼
    </a>

    xsl:apply-templates select=".." mode="number"
    xsl:text 
    xsl:apply-templates