Name
[2.0] upper-case()
Given a string, returns the uppercased version of that string.
Syntax
xs:stringupper-case(xs:string?)
Inputs
An xs:string
value.
Outputs
An xs:string in which all
of the lowercase letters in the original string have been
converted to uppercase. Any character that was originally in
uppercase and any character that does not have an uppercase value
is returned as is. If the value of the argument is the empty
sequence, a zero-length string is returned.
Accented characters and other features of the world’s
languages mean that changing the case of a string might change its
length. Also be aware that upper-case() and lower-case() are not always the
inverse of each other in some languages. All of the
case-conversion rules are defined by the Unicode standard, and
XSLT processors are expected to conform with those rules.
Defined in
XQuery 1.0 and XPath 2.0 Functions and Operators section 7.4, “Functions on String Values.”
Example
Here is a stylesheet that illustrates the upper-case() function. Notice that
we’re using <xsl:output method="xml"
encoding="UTF-8"/> to make sure the character set is
handled properly:
<?xml version="1.0" encoding="UTF-8"?> <!-- upper-case.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <testcase> <heading>Tests of the upper-case() function:</heading> <test> <label>upper-case('Lily') = </label> <result><xsl:value-of select="upper-case('Lily')"/></result> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access