XML technologies / XSLT / Reference: XSLT 1.0 and 2.0 elements / character-map
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 6.)
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
Declaration xsl:character-map combines a list of character replacement rules xsl:output-character into a named character mapping table.
Classification | Declaration |
Function group | Output format definition |
Introduced | XSLT 2.0 |
Position in the stylesheet and permitted contents:
xsl:character-map is a declaration appearing only as a child of root elements xsl:stylesheet or xsl:transform.
Its only permitted contents are one or more instructions xsl:output-character. Alternatively, it may be empty.
Attributes:
Standard attributes apply. Two element-specific attributes are also provided: required attribute name and optional attribute use-character-maps.
name
Value | |
Usage | Required |
Introduced | XSLT 2.0 |
The declaration’s QName, allowing the defined mapping to be included in a declaration xsl:output or another declaration xsl:character-map.
use-character-maps
Value | QNames (of character-map declarations) |
Usage | Optional |
Introduced | XSLT 2.0 |
Optional. Attribute use-character-maps lists, as space-separated tokens, the QNames of further declarations xsl:character-map to include. Their order matters.
Usage:
Element xsl:character-map declares a named replacement table for characters in the result tree (final result tree). Each replacement is defined by an instruction xsl:output-character directly inside the declaration xsl:character-map or in another declaration included by name through attribute use-character-maps.
A character-map declaration’s QName is assigned through required attribute name. Importing or including stylesheet modules adds external declarations. Name conflicts are resolved by import precedence, for example when a declaration xsl:output references them. Identically named declarations with equal precedence are a static error (ERR XTSE1580), since they would be indistinguishable.
Further declarations xsl:character-map can be included in the named collection, referenced by name in attribute use-character-maps.
A character map must not include itself through a cycle; this is a static error (ERR XTSE1600). It is also an error if a reference in use-character-maps has no matching named declaration xsl:character-map (ERR XTSE1590).
If included declarations duplicate replacements for a character, the last rule wins. Within a declaration, document order determines this.
For included declarations, reference order matters: token order in attribute use-character-maps. The last included collection containing the duplicate wins.
Included rules override rules inside the including declaration, analogous to template inclusion, not import. Thus an internal rule cannot override an included one, but the reverse is possible.
An empty element xsl:character-map can use attribute use-character-maps to combine other declarations xsl:character-map into a named group.
Example:
See the example under xsl:output-character.
Element definition:
XSLT 1.0:
Element unavailable in XSLT 1.0.
XSLT 2.0:
<!-- Category: declaration -->
<xsl:character-map
name = qname
use-character-maps? = qnames>
<!-- Content: (xsl:output-character*) -->
</xsl:character-map>
Copyright © Galileo Press, Bonn 2008
You may print the online version for your private use.
Otherwise, this chapter from “XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn