- Enabled apply-templates for due dates.
- Added various positional cases for due dates.
1 parent 94deb23 commit d8d131dbfed71d9565ac02c9ad2a755eb8b996ae
nstanger authored on 19 Jul 2012
Showing 3 changed files
View
6
modules/global-elements.xml
</xsl:if>
<xsl:if test="contains( @style, 'underline' )">
<xsl:text>\underline{</xsl:text>
</xsl:if>
<xsl:value-of select="/document/due-date" />
<xsl:apply-templates select="/document/due-date" mode="inline" />
<!-- It doesn't actually matter in what order we generate the closing braces. -->
<xsl:if test="contains( @style, 'underline' )">
<xsl:text>}</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="contains( @style, 'underline' )">
<xsl:text disable-output-escaping="yes">&lt;ul&gt;</xsl:text>
</xsl:if>
<xsl:value-of select="/document/due-date" />
<xsl:apply-templates select="/document/due-date" mode="inline" />
<xsl:if test="contains( @style, 'underline' )">
<!-- We must close the elements in the correct order! -->
<xsl:text disable-output-escaping="yes">&lt;/ul&gt;</xsl:text>
</xsl:if>
It seems pretty unlikely that someone will want to put the due date in the HTML document title, but I'm paranoid :).
-->
<template name="DueDate-strip" match="DueDate" mode="strip">
<common formats="/html/xhtml/">
<xsl:value-of select="/document/due-date" />
<xsl:apply-templates select="/document/due-date" mode="inline" />
</common>
</template>
 
 
View
51
modules/titling.xml
 
<!-- Items appearing in the document body. -->
<!-- Document title. -->
<template name="document-title" match="document/title">
<!--
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" match="document/title" mode="title">
<!--
This template is irrelevant for LaTeX, as the document title is generated by a \maketitle in the generated LaTeX markup (see xml2xslt.xsl).
-->
<common formats="/html/xhtml/">
<h1>
<xsl:if test="( /document/@class = 'tutorial' ) or ( /document/@class = 'laboratory' ) or ( /document/@class = 'assignment' )">
</template>
 
<!-- Document author. -->
<template name="document-author" match="document/author">
<common formats="/html/xhtml/"><p><xsl:apply-templates /></p></common>
</template>
<!-- Document date. -->
<common formats="/html/xhtml/">
<p>
<xsl:apply-templates />
</p>
</common>
</template>
<!-- Document date (doesn't appear in normal body). -->
<template name="document-date" match="document/date" />
<!-- Assignment due date. This only makes sense for assignments. -->
<template name="document-due-date" match="document/due-date">
<!--
Assignment due date at the start of an (X)HTML document. This is irrelevant for (Xe)LaTeX, as the (title) due date is generated by a \maketitle in the generated LaTeX markup (see xml2xslt.xsl). This only makes sense for assignments.
-->
<template name="document-due-date-title" match="document/due-date" mode="title">
<common formats="/html/xhtml/">
<xsl:if test="/document/@class != 'assignment'">
<xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment".</xsl:message>
</xsl:if>
<p>
<xsl:text>DUE DATE: </xsl:text>
<xsl:value-of select="." />
<xsl:apply-templates />
</p>
</common>
</template>
<!--
Assignment due date anywhere else in the main body of the document. We add the mode to avoid the due date being caught up by the top-level apply-templates and thus appearing as the first paragraph of the document body.
-->
<template name="document-due-date-inline" match="document/due-date" mode="inline">
<common>
<xsl:if test="/document/@class != 'assignment'">
<xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment".</xsl:message>
</xsl:if>
<xsl:apply-templates />
</common>
</template>
 
<!-- Empty template to catch any non-moded attempts to process the due date. -->
<template name="document-due-date" match="document/due-date" />
 
<!--
Chapter titles for tutorials and labs, which are essentially chapters when included in a course book, but are marked up as documents in themselves.
View
xml2xslt.xsl