| |
---|
| | <xsl:text>\title{</xsl:text> |
---|
| | <!-- |
---|
| | Note that tutorials and labs have their own special macros, which is why they're not included here (see the TODO in the "chapter-title" template below). |
---|
| | --> |
---|
| | <xsl:if test="( /document/@class = 'assignment' ) or ( /document/@class = 'project' )"> |
---|
| | <xsl:if test="index-of(('assignment', 'project', 'question set'), /document/@class)"> |
---|
| | <xsl:if test="$showanswers='yes'">Sample Solution for </xsl:if> |
---|
| | <xsl:call-template name="PaperCode" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:value-of select="concat( upper-case( substring( /document/@class, 1, 1 ) ), substring( /document/@class, 2 ) ) " /> |
---|
| | <xsl:value-of select="infosci:title-case(/document/@class)" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:value-of select="/document/@sequence-number" /> |
---|
| | <!-- If the title's empty, there's no point in including the ": \\". --> |
---|
| | <xsl:if test="node()"> |
---|
| | <xsl:if test="node() and (/document/@class != 'question set')"> |
---|
| | <xsl:text>: \\</xsl:text> |
---|
| | </xsl:if> |
---|
| | </xsl:if> |
---|
| | <xsl:apply-templates /> |
---|
| |
---|
| | <!-- |
---|
| | 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. |
---|
| | --> |
---|
| | <common formats="/html/xhtml/"> |
---|
| | <xsl:if test="( /document/@class = 'tutorial' ) or ( /document/@class = 'laboratory' ) or ( /document/@class = 'assignment' ) or ( /document/@class = 'project' )"> |
---|
| | <xsl:if test="index-of(('tutorial', 'laboratory', 'assignment', 'project'), /document/@class)"> |
---|
| | <xsl:if test="$showanswers='yes'"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="( /document/@class = 'tutorial' ) or ( /document/@class = 'laboratory' )"> |
---|
| | <xsl:when test="index-of(('tutorial', 'laboratory'), /document/@class)"> |
---|
| | <xsl:text>Selected Answers for </xsl:text> |
---|
| | </xsl:when> |
---|
| | <xsl:when test="( /document/@class = 'assignment' ) or ( /document/@class = 'project' )"> |
---|
| | <xsl:when test="index-of(('assignment', 'project'), /document/@class)"> |
---|
| | <xsl:text>Sample Solution for </xsl:text> |
---|
| | </xsl:when> |
---|
| | </xsl:choose> |
---|
| | </xsl:if> |
---|
| | <xsl:call-template name="PaperCode" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:value-of select="concat( upper-case( substring( /document/@class, 1, 1 ) ), substring( /document/@class, 2 ) ) " /> |
---|
| | <xsl:value-of select="infosci:title-case(/document/@class)" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:value-of select="/document/@sequence-number" /> |
---|
| | <!-- If the title's empty, there's no point in including the ": ". --> |
---|
| | <xsl:if test="node()"> |
---|
| |
---|
| | |
---|
| | <!-- Assignment due date. This only makes sense for assignments in LaTeX. --> |
---|
| | <template name="preamble-due-date" match="document/due-date" mode="preamble"> |
---|
| | <common formats="/latex/xelatex/"> |
---|
| | <xsl:if test="( /document/@class != 'assignment' ) and ( /document/@class != 'project' )"> |
---|
| | <xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment" or "project".</xsl:message> |
---|
| | <xsl:if test="not(index-of(('assignment', 'project', 'question set'), /document/@class))"> |
---|
| | <xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment", "project", or "question set".</xsl:message> |
---|
| | </xsl:if> |
---|
| | <xsl:if test="/document/date"> |
---|
| | <xsl:message terminate="yes">You can't include both a due-date and a date element in an assignment.</xsl:message> |
---|
| | </xsl:if> |
---|
| |
---|
| | --> |
---|
| | <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' ) or ( /document/@class = 'project' )"> |
---|
| | <xsl:if test="index-of(('tutorial', 'laboratory', 'assignment', 'project'), /document/@class)"> |
---|
| | <xsl:if test="$showanswers='yes'"> |
---|
| | <xsl:choose> |
---|
| | <xsl:when test="( /document/@class = 'tutorial' ) or ( /document/@class = 'laboratory' )"> |
---|
| | <xsl:when test="index-of(('tutorial', 'laboratory'), /document/@class)"> |
---|
| | <xsl:text>Selected Answers for </xsl:text> |
---|
| | </xsl:when> |
---|
| | <xsl:when test="( /document/@class = 'assignment' ) or ( /document/@class = 'project' )"> |
---|
| | <xsl:when test="index-of(('assignment', 'project'), /document/@class)"> |
---|
| | <xsl:text>Sample Solution for </xsl:text> |
---|
| | </xsl:when> |
---|
| | </xsl:choose> |
---|
| | </xsl:if> |
---|
| | <xsl:call-template name="PaperCode" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:value-of select="concat( upper-case( substring( /document/@class, 1, 1 ) ), substring( /document/@class, 2 ) ) " /> |
---|
| | <xsl:value-of select="infosci:title-case(/document/@class)" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | <xsl:value-of select="/document/@sequence-number" /> |
---|
| | <!-- If the title's empty, there's no point in including the ": ". --> |
---|
| | <xsl:if test="node()"> |
---|
| |
---|
| | 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' ) and ( /document/@class != 'project' )"> |
---|
| | <xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment" or "project".</xsl:message> |
---|
| | <xsl:if test="not(index-of(('assignment', 'project', 'question set'), /document/@class))"> |
---|
| | <xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment", "project", or "question set".</xsl:message> |
---|
| | </xsl:if> |
---|
| | <p> |
---|
| | <xsl:text>DUE DATE: </xsl:text> |
---|
| | <xsl:apply-templates /> |
---|
| |
---|
| | 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' ) and ( /document/@class != 'project' )"> |
---|
| | <xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment" or "project".</xsl:message> |
---|
| | <xsl:if test="not(index-of(('assignment', 'project', 'question set'), /document/@class))"> |
---|
| | <xsl:message terminate="yes">You can only use the due-date element if the document class is "assignment", "project", or "question set".</xsl:message> |
---|
| | </xsl:if> |
---|
| | <xsl:apply-templates /> |
---|
| | </common> |
---|
| | </template> |
---|
| |
---|
|