Added subtitle element. Also renamed a few templates to something slightly more consistent.
1 parent d48443b commit f54a8e54acdd10c09eb468f964857ab03a3c3780
Nigel Stanger authored on 3 Jul 2013
Showing 1 changed file
View
50
modules/titling.xml
<xsl:text>: \\</xsl:text>
</xsl:if>
</xsl:if>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
<!--
Process the subtitle, if any. If there is no author specified, then we can appropriate the \author, otherwise, append it to the main title.
-->
<xsl:if test="/document/subtitle and /document/author">
<xsl:text>\\[0.25\baselineskip] \large </xsl:text>
<xsl:value-of select="/document/subtitle" />
</xsl:if>
<xsl:text>}</xsl:text>
<xsl:if test="/document/subtitle and not( /document/author )">
<xsl:text>\author{</xsl:text>
<xsl:value-of select="/document/subtitle" />
<xsl:text>}</xsl:text>
</xsl:if>
</common>
<!--
For the HTML title, strip out any markup (e.g., emphasis), as this is not interpreted within the <title> tag, resulting in raw HTML markup in the window title. Ick. We do this by switching to "strip" mode.
-->
<xsl:apply-templates mode="strip" />
</common>
</template>
 
<!--
Document subtitle. This template is merely to trap the general apply-templates and prevent the subtitle being output twice. The actual processing of this element is done in the preamble-title template above.
-->
<template name="preamble-subtitle" match="document/subtitle" mode="preamble" />
 
<!-- Document author. This only makes sense for LaTeX. -->
<template name="preamble-author" match="document/author" mode="preamble">
<common formats="/latex/xelatex/">
<xsl:text>\author{</xsl:text>
<!--
Document title for an (X)HTML document. This template is irrelevant for LaTeX, as the document title is generated by a \maketitle in the generated LaTeX markup (see xml2xslt.xsl). The title element is applied explicitly by xml2xslt.xsl, so we add a mode to ensure that this it isn't caught up by the following general apply-templates. Otherwise, the title would appear twice in the document body.
-->
<template name="document-title-title" match="document/title" mode="title">
<!--
-->
<common formats="/html/xhtml/">
<h1>
<xsl:if test="( /document/@class = 'tutorial' ) or ( /document/@class = 'laboratory' ) or ( /document/@class = 'assignment' )">
<xsl:if test="$showanswers='yes'">
<xsl:text>: </xsl:text>
</xsl:if>
</xsl:if>
<xsl:apply-templates />
<!-- If there’s a subtitle, add it to the end of the title. -->
<xsl:if test="/document/subtitle">
<xsl:text>: </xsl:text>
<xsl:value-of select="/document/subtitle" />
</xsl:if>
</h1>
</common>
</template>
<!--
Document subtitle. This template is merely to trap the general apply-templates and prevent the subtitle being output twice. The actual processing of this element is done in the document-title template above.
-->
<template name="document-subtitle" match="document/subtitle" />
 
<!-- Document author. -->
<template name="document-author" match="document/author">
<common formats="/html/xhtml/">
<xsl:apply-templates />
</common>
</template>
 
<!-- Empty template to catch any un-moded attempts to process the due date or title. -->
<template name="document-due-date" match="document/due-date" />
<template name="document-title" match="document/title" />
<!-- Empty templates to catch any un-moded attempts to process the due date or title. -->
<template name="document-due-date-unmoded" match="document/due-date" />
<template name="document-title-unmoded" match="document/title" />
 
<!--
Chapter titles for tutorials and labs, which are essentially chapters when included in a course book, but are marked up as documents in themselves.