diff --git a/modules/titling.xml b/modules/titling.xml index 9f58c8e..b2c676a 100644 --- a/modules/titling.xml +++ b/modules/titling.xml @@ -27,7 +27,19 @@ </xsl:if> </xsl:if> <xsl:apply-templates /> + <!-- + 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. @@ -66,6 +78,11 @@ </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/"> @@ -116,9 +133,6 @@ 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' )"> @@ -151,9 +165,19 @@ </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"> @@ -194,9 +218,9 @@ </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" /> <!--