apply-character-map

apply-character-map — Applies an XSLT character map

Synopsis

<xsl:template name="apply-character-map">
<xsl:param name="content"/>
<xsl:param name="map.contents"/>
  ...
</xsl:template>

Description

This template applies an XSLT character map; that is, it causes certain individual characters to be substituted with strings of one or more characters. It is useful mainly for replacing multiple “special” characters or symbols in the same target content. It uses the value of map.contents to do substitution on content, and then returns the modified contents.

Note

This template is a very slightly modified version of Jeni Tennison’s replace_strings template in the multiple string replacements section of Dave Pawson’s XSLT FAQ.

The apply-string-subst-map template is essentially the same template as the apply-character-map template; the only difference is that in the map that apply-string-subst-map expects, oldstring and newstring attributes are used instead of character and string attributes.

Parameters

content

The content on which to perform the character-map substitution.

map.contents

A node set of elements, with each element having the following attributes:

  • character, a character to be replaced
  • string, a string with which to replace character