Using Template Parameters

THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO

XSLT processors can read parameters sent by a calling program along with the source xml file and the actual template to use. Tópico automatically sends the following parameters, that only need to be used by the template.

Text string parameters

The following table lists the text parameters that are sent to templates.

Text string parameters
Parameter Description
<xsl:param name="collection_title"/> The collection title
<xsl:param name="newsfeed_title"/> The newsfeed title
<xsl:param name="language"/> The language code string
<xsl:param name="generator"/> The program name and version number
<xsl:param name="topic_id"/> The topic id
<xsl:param name="date"/> The current date
<xsl:param name="time"/> The current time
<xsl:param name="copyright"/> The copyright holder found on the home page
<xsl:param name="description"/> The short description of the current topic
<xsl:param name="keywords"/> The keywords associated with the collection and the keywords associated with the topic
<xsl:param name="stylesheet"/> The main CSS stylesheet
<xsl:param name="prev_target"/> The target of the "previous" navigation link
<xsl:param name="prev_text"/> The text of the "previous" navigation link
<xsl:param name="next_target"/> The target of the "next" navigation link
<xsl:param name="next_text"/> The text of the "next" navigation link
<xsl:param name="nav_separator"/> The navigation links separator
<xsl:param name="page_num"/> The published page number
<xsl:param name="page_nav"/> The total number of navigation pages
<xsl:param name="page_total"/> The total number of published pages
<xsl:param name="feed_image"/> The news feed image
<xsl:param name="feed_root"/> The news feed file name root
<xsl:param name="show_related" select="no"/> A flag to show the related links or not

XMLnode set parameters

The following table lists the xml node set parameters that are sent to templates.

Node set parameters
Parameter Description
<xsl:param name="menu_tree"/> The unordered list that contains the menu tree
<xsl:param name="breadcrumb"/> The path to the current topic with links to parents

All of the above parameters are defined in the file import.xsl that's found in all Tópico online/xsl folder.

Using parameters with xsl:value-of element

One way to use a parameter in your template is to use the xsl:value-of element. The following example displays the date in a simple span element with a date class that can be used by the stylesheet to format dates differently than their surrounding content.

XSLT
			<span class="date"><xsl:value-of select="$date"></span>
		

Using parameters with a parameter attributes

When you need to use the parameter as an attribute of an XML element, it's far easier to use a parameter attribute like this:

XSLT
			<html xml:lang="{$language}">
			<head>...</head>
			<body>...</body>
			</html>
		

Learning more about XSLT

This topic only scratches the surface of working with template parameters in XSLT.

Learn more about the XSLT standard.

THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO

136 / 194