From d1e518ebdc00297465b75251ad091e5eb757a52e Mon Sep 17 00:00:00 2001 From: Michael Kay Date: Fri, 25 Oct 2024 11:31:17 +0100 Subject: [PATCH] New character-map() function --- .../xslt-40/src/function-catalog.xml | 56 +++++++++++++++++ specifications/xslt-40/src/xslt.xml | 60 +++++++++++-------- 2 files changed, 92 insertions(+), 24 deletions(-) diff --git a/specifications/xslt-40/src/function-catalog.xml b/specifications/xslt-40/src/function-catalog.xml index 1b5e34257..accf104db 100644 --- a/specifications/xslt-40/src/function-catalog.xml +++ b/specifications/xslt-40/src/function-catalog.xml @@ -1461,6 +1461,62 @@ + + + + + + + + + deterministic + context-dependent + focus-independent + + +

Delivers the content of a character map declared using xsl:character-map.

+
+ + +

The static context for a stylesheet package includes a set of named character maps. This function + delivers the content of a character map if a character map with the given name is present in the + static context of the containing package, or an empty sequence otherwise.

+ +
+ + +

The returned character map is in a format suitable for use within the $options + parameter of the serialize function.

+
+ + + +

Consider the following character map declaration:

+ + + + + + ]]> +

Then the result of the function call character-map(xs:QName('jsp')) is the map:

+ +map { + "«": "<%", + "»": "%>", + "§": '"' +} + +

This might be used in a call to the function serialize, for example:

+ +serialize($input, {'method': 'xml', + 'use-character-maps': character-map(xs:QName('jsp')) }) + + +
+
+
diff --git a/specifications/xslt-40/src/xslt.xml b/specifications/xslt-40/src/xslt.xml index ff3588013..7214b4ece 100644 --- a/specifications/xslt-40/src/xslt.xml +++ b/specifications/xslt-40/src/xslt.xml @@ -9651,7 +9651,7 @@ and version="1.0" otherwise.

variables are defined by the variable binding elements that are in scope for the containing element (see ).

- +

The statically known function definitions are:

@@ -9744,23 +9744,7 @@ and version="1.0" otherwise.

a dynamic error.

- -

The set of statically known - documents is implementation-defined.

- The statically known documents, statically known - collections, and the statically known default collection - type are implementation-defined. -
- -

The set of statically known - collections is implementation-defined.

- -
- -

The statically known - default collection type is implementation-defined.

- -
+

The set of statically known decimal formats is the set of decimal formats defined by @@ -9786,6 +9770,9 @@ and version="1.0" otherwise.

The set of named keys, used by the key function

+ +

The set of named character maps, used by the character-map function

+

The values of system properties, used by the @@ -9796,14 +9783,14 @@ and version="1.0" otherwise.

element-available function

-

A dynamic function call clears the first of these +

If these functions are called within a , the results will reflect the capabilities and configuration of the processor used to perform static analysis, while if they @@ -38661,9 +38648,17 @@ return ($m?price - $m?discount)

It is not an error if the same character map is referenced more than once, directly or indirectly.

-

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, + +

For every xsl:character-map declaration in a , + other than one that is overridden by another of higher , + the static context of the package includes a named character map derived from the + xsl:character-map declaration. The name of the named character map is the + QName formed by expanding the value of the name attribute, and the content is + a map of type map{xs:string, xs:string} that maps characters (represented as + xs:string instances of length 1) to their replacement strings.

+ +

Recursive expansion of character maps using use-character-maps + attributes may produce several mappings for the same character. In this situation, the last character mapping takes precedence. To establish the ordering, the following rules are used:

@@ -38767,6 +38762,23 @@ return ($m?price - $m?discount) validation.

+ + The character-map function + + + The contents of a character map declared using xsl:character-map are now + available dynamically via a new character-map function. + + +

The contents of a character map declared using xsl:character-map are + available dynamically via the character-map function.

+ + + + + +
+ Disabling Output Escaping

Normally, when using the XML, HTML, or XHTML output method, the serializer will