<xsl:param name="keyNode"/>
<!-- suggested value for generatedID output, a contextually meaningful ID string -->
<xsl:param name="templateID"/>
+ <!-- Strip leading and trailing whitespaces, and replace repeating whitespaces with a single space -->
+ <xsl:variable name="normalizedID" select="normalize-space($templateID)"/>
<xsl:variable name="conflictSource" select="preceding::refsect1/title|preceding::refsect1/info/title|
preceding::refsect2/title|preceding::refsect2/info/title|
preceding::varlistentry/term[1]"/>
<xsl:choose>
<!-- special case conflictCount = 0 to preserve compatibility with URLs generated by previous versions of this XSL stylesheet where possible -->
<xsl:when test="$conflictCount = 0">
- <xsl:value-of select="$templateID"/>
+ <xsl:value-of select="$normalizedID"/>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="concat($templateID, $conflictCount)"/>
+ <xsl:value-of select="concat($normalizedID, $conflictCount)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>