XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
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
fn:lower-case
Category:
String functions – analysis and manipulation
Origin:
XPath 2.0
Return value:
A xs:string string; a copy of the input string in which upper case letters originally contained are replaced by corresponding lower case letters.
Call/Arguments:
fn:lower-case($inputString)
$inputString:
A xs:string string in which the contained upper case letters are replaced by the corresponding lower case letters. If the empty sequence is passed on to the function, it returns an empty string.
Purpose of use:
The fn:lower-case() function completely converts all upper case letters in the input string to the corresponding lower case letters for the output string. The conversion is not reversible.
If a string is passed on to the function, the lower case letter corresponding to the upper case letter is determined according to the rules of Unicode Case Mapping for the character replacement. This is important in cases in which an ambiguous replacement possibility exists (Unicode Special Casing). For example, the Greek upper case letter Σ (sigma) has two variants as lower case letter: σ and ς (see also fn:upper-case()).
If there is no corresponding lower case letter for an upper case letter, no replacement is made. Digits, punctuation marks and other non-letter characters are also not affected.
The appropriate rules can be found in the Unicode Standard. The mapping of the letters is performed by means of a table which contains the corresponding characters. Here an excerpt:
# preceding further mappings
003F;QUESTION MARK; Po;0; ON;;;;;N;;;;;
0040;COMMERCIAL AT; Po;0; ON;;;;;N;;;;;
0041;LATIN CAPITAL LETTER A; Lu;0; L;;;;;N;;;;0061;
0042;LATIN CAPITAL LETTER B; Lu;0; L;;;;;N;;;;0062;
...
# further mappings
...
03A1;GREEK CAPITAL LETTER RHO; Lu;0; L;;;;;N;;;;03C1;
03A3;GREEK CAPITAL LETTER SIGMA;Lu;0; L;;;;;N;;;;03C3;
# following further mappings
Explanation:
Letters in Unicode are classified in the category L (»Letter«) which is divided into different subgroups 'L&' (& is a placeholder). For all characters marked in the middle column with 'Lu' (»Letter, uppercase«) there is a corresponding character which represents its lowercased version 'Ll' (Letter, lowercase). The single 'L' (column 5) marks the Bidi class (Bidirectional Behavior) as »left-to-right«.
There is no corresponding lower case for punctuation marks and special characters of catagory P (see the lines QUESTION MARK »?« and COMMERCIAL AT »@« of the mapping table in the excerpt above). Therefore, they are not affected by a replacement and marked with the abbreviation P 'Po' (Punctuation, other). Their Bidi signature 'ON' means in this connection 'other neutrals'.
Attention: »titlecaps« are no upper case letters!
A further category 'Lt' (»Letter, titlecase«) provides for all alphabetical characters the same glyphs irrespective of their case sensitivity. It should not be confused with upper case letters – the information on the notation is still included in a string converted in titlecaps. However, when converting upper case letters in lower case letters or vice versa, the information on the original notation gets lost.
A correct character replacement is language-dependent. Not all characters of all languages are assigned to the category L, which means they do not have a priori the concept of upper case/lower case letters. But also in languages which (for the most part) are written with the normal Latin alphabet the conversion is inconsistent in a cross-language way: So, the »normal« small i in Turkish corresponds to the capital dotted İ, in contrast the »normal« capital I corresponds to the undotted ı.
Alternative: conversion during the presentation
If the text shall be presented in lower case letters by using XSL-FO or CSS, the text-transform="lowercase" property can be applied. By using this method, the representation as lower case letters is achieved without any real conversion, which means without loss of information.
Example – conversion of a string into lower case letters:
fn:lower-case("ABc!D")
results in: abc!d. The exclamation mark is not affected by the conversion. The already lowercased c remains unchanged. Afterwards, a reconversion of the string to the original condition (reconstruction) is not possible anymore.
Function definition:
XPath 1.0:
The function is not available.
XPath 2.0:
fn:lower-case($arg as xs:string?) as xs:string
<< back | next >> |
Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany