• Added BlackboardPath element for more easily specifying paths to files in the Blackboard file system.
1 parent 968ddea commit 900de4d8cca8e0a295707eb0f4ddb53bce1ce839
Nigel Stanger authored on 11 Feb 2016
Showing 2 changed files
View
4
modules/hyperlinks.xml
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<!--
Sometimes the hyperlink content may be explicitly split across multiple lines, separated by <br> elements. This isn't a problem in (X)HTML, but it breaks (Xe)LaTeX, because you can't include a \\ inside most macros. The solution is to explicitly process the sub-elements, and wrap appropriate hyperref macros around them, /except/ for any embedded <br> elements.
Sometimes the hyperlink content may be explicitly split across multiple lines, separated by <br> elements. This isn't a problem in (X)HTML, but it breaks (Xe)LaTeX, because you can't include a \\ inside most macros. The solution is to explicitly process the sub-elements, and wrap appropriate hyperref macros around them, /except/ for any embedded <br> elements. This does lead to some slightly
odd output when you embed markup in the hyperlink text.
We can't just call hyperlink-internal, because we still want to process the <br> elements.
-->
<xsl:for-each select="node()">
View
33
modules/otago-specific.xml
</template>
<template name="paper-number" match="paper/paper-number">
<common><xsl:apply-templates /></common>
</template>
<!--
Generate a hyperlink to a file on Blackboard according to the current paper. It takes a path of the form "foo/bar/baz.html" and adds an appropriate URL prefix. For example, given the paper INFO214 offered in S1 2016, we get https://blackboard.otago.ac.nz/bbcswebdav/courses/INFO214_S1DNI_2016/foo/bar/baz.html.
We use the trick of constructing a hyperlink element in a variable from the original BlackboardPath element, copying across all attributes except @path, and constructing a new @url element as appropriate. We can then just apply-templates on the variable. The paper identifier in the output URL is constructed from the global stylesheet variables $subject-code, $paper-number, $period-code, and $paper-year. The "DNI" is hard-coded (naughty!) for now, as that applies to all the papers we offer anyway.
@path: The path to the file within Blackboard's file system.
@label: The name of the anchor to link to in the URL (i.e., url#label). [optional]
@target: The target of the URL (e.g., _blank). Only relevant to (X)HTML. [optional]
-->
<template name="BlackboardPath" match="BlackboardPath">
<common>
<xsl:variable name="hyperlink-node">
<xsl:element name="hyperlink">
<xsl:copy-of select="@*[not(name()='path')]" />
<xsl:attribute name="url">
<xsl:text>https://blackboard.otago.ac.nz/bbcswebdav/courses/</xsl:text>
<xsl:value-of select="$subject-code" />
<xsl:value-of select="$paper-number" />
<xsl:text>_</xsl:text>
<xsl:value-of select="$period-code" />
<xsl:text>DNI_</xsl:text>
<xsl:value-of select="$paper-year" />
<xsl:text>/</xsl:text>
<xsl:value-of select="@path" />
</xsl:attribute>
<xsl:copy-of select="node()" />
</xsl:element>
</xsl:variable>
<xsl:apply-templates select="$hyperlink-node" />
</common>
</template>
 
 
<!--