The tcc.top.nav.bar template generates the standard TCC HTML page-top navigation bar. It takes three parameters:
Previous page's node, or empty if this is the first page.
Next page's node, or empty if this is the last page.
Node for the home page.
<xsl:template name="tcc.top.nav.bar"> <xsl:param name="prev"/> <xsl:param name="next"/> <xsl:param name="home"/> |
The nav bar is wrapped in a div element to put it all in a separate block. This element has class topnavbar so that a CSS stylesheet can change the appearance of this element.
<div class="topnavbar"> |
The word “Next” always appears: it is a link if there is a next page, or a placeholder if not.
The xsl:when tests to see if there is a next page.
The href.target template returns the URL corresponding to a given node.
<xsl:choose>
<xsl:when test="count($next) > 0"> <!-- Is there a prev? -->
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$next"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text>Next</xsl:text>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:text>Next</xsl:text>
</xsl:otherwise>
</xsl:choose>
|
Next we output a slash, with spaces around it, to separate “Next” from “Previous”.
<xsl:text> / </xsl:text> |
Generation of the “Previous” link is similar: it is an actual link if there is a previous page, otherwise it is the word “Previous” as a placeholder.
<xsl:choose>
<xsl:when test="count($prev) > 0"> <!-- Is there a prev? -->
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$prev"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text>Previous</xsl:text>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:text>Previous</xsl:text>
</xsl:otherwise>
</xsl:choose>
|
Again, we output a slash to set off following elements.
<xsl:text> / </xsl:text> |
The “home” link here is called “Contents.” Again, it is followed by a slash.
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$home"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text>Contents</xsl:text>
</a>
<xsl:text> / </xsl:text>
|
Lastly we output links to the TCC help system and the Tech homepage.
<a href="http://www.nmt.edu/tcc/">TCC Help System</a>
<xsl:text> / </xsl:text>
<a href="http://www.nmt.edu/">NM Tech homepage</a>
</div>
</xsl:template> <!-- End of tcc.top.nav.bar -->
|