xsl:character-map

Declares a character map defined by a unique name. A stylesheet cannot contain two or more character maps with the same name. Character maps are supported by XSLT 2.0 only.

Format

Description

A character map allows a specific character appearing in a text or attribute node in the final result tree to be substituted by a specified string of characters during serialization. The character map that is supplied as a parameter to the serializer is determined from the xsl:character-map elements referenced from the xsl:output declaration for the selected output definition.

Character/string mappings can be defined in the body of the xsl:character-map element using one or more xsl:output-character elements, or they can be defined in an external character map referenced using the optional use-character-maps attribute. If the character map references multiple external character maps, separate each character map's Qname with a space.

An output definition, after recursive expansion of character maps referenced via its use-character-maps attribute, may contain several mappings for the same character. In this situation, the last character mapping takes precedence.

If a character is mapped, it is not subjected to XML or HTML escaping.

Example

This example shows a composite character map - one constructed using both internally defined character mappings (xsl:output-character), and references to externally defined character maps (the use-character-maps attribute):

 
Free Stylus Studio XML Training: