SPFE Documentation | Collections > SPFE Function Reference > title-to-anchor

Function: title-to-anchor

title-to-anchor(title as item()*) as item()*

Description

You can use the title-to-anchor function to convert a title text into a string that can be used as an anchor value. The function works by changing all characters not allowed in an anchor into underscores.

Typical uses for this function occur in the presentation stage where you want to create an anchor so that a link can be created to a point inside a topic. Where no other identifier is available, you can use title-to-anchor to create a suitable anchor value.

Return value

Return type: item()*

Returns a string in which the characters that would not be legal in an HTML anchor string have been converted to underscores.

Source file

$SPFEOT_HOME/1.0/scripts/common/utility-functions.xsl

Parameters

title

Type: item()*

The title parameter is used to pass in the text of the title that is to be coverted to an anchor string.

Definition

            <xsl:function name="sf:title-to-anchor">
		               <xsl:param name="title"/>
		             
		  <xsl:value-of select="translate(encode-for-uri( normalize-space($title)), '%', '')"/>
	           </xsl:function>