| |
---|
| | <!-- |
---|
| | Calculate the nesting depth up front, so that we can limit it to 2 for LaTeX. Note that we have to skip counting the parent <section> element, as that's the section currently being processed. Including it would produce a minimum depth of 1, but the minimum depth in LaTeX is actually 0. |
---|
| | --> |
---|
| | <xsl:variable name="depth"> |
---|
| | <xsl:number value="count( ../ancestor::section )" /> |
---|
| | <xsl:if test="count( ../ancestor::section ) gt 2">2</xsl:if> |
---|
| | <xsl:number value="min( ( count( ../ancestor::section ), 2 ) )" /> |
---|
| | </xsl:variable> |
---|
| | <xsl:text>\</xsl:text> |
---|
| | <!-- Generate the correct number of "sub"s for LaTeX. --> |
---|
| | <xsl:call-template name="generate-subs"> |
---|
| |
---|
| | <!-- |
---|
| | Calculate the nesting depth up front, so that we can limit it to 6 for HTML. Add 1 because <h1> is reserved for the main document title; section headings start at <h2>. |
---|
| | --> |
---|
| | <xsl:variable name="depth"> |
---|
| | <xsl:number value="1 + count( ancestor::section )" /> |
---|
| | <xsl:if test="1 + count( ancestor::section ) gt 6">6</xsl:if> |
---|
| | <xsl:number value="min( ( 1 + count( ancestor::section ), 6 ) )" /> |
---|
| | </xsl:variable> |
---|
| | <!-- |
---|
| | Generate the correct level of <Hn> element based on the value of $depth. Note the use of an attribute value template to force XSLT to interpret the contents of the name attribute as a function call rather than as the element name. |
---|
| | --> |
---|
| |
---|
|