Functions Defined By XSLT
The following functions can occur in many XSLT attributes, such as xsl:value-of.select and xsl:for-each.select.
| Function | Description/ Syntax | Example |
|---|---|---|
| ceiling | The ceiling function returns the smallest integer that is equal to or is larger than the numeric value of the number argument. | ceiling(3.57) |
| concat | Concatenates two or more strings, which are listed in the parentheses | concat($fname,’ ‘, $lname) |
| count | The count function counts and returns the number of nodes in a node-set. | count(elements) |
| floor | The floor function returns the largest integer that is equal to or is smaller than the numeric value of the number argument. | floor(3.57) |
| normalize-space | Removes white-space from the beginning and end of the string | normalize-space($fname) |
| position | The position function returns the position number in the current node list of the node that is currently being processed by an xsl:for-each or xsl:apply-templates element. There are no arguments. | position |
| round | The round function rounds a number to its closest integer. | round(3.57) |
| string | The string function converts the value argument to a string. | string |
| string-length | The string-length function returns the number of characters in a string. The string argument is optional. If omitted, the default is to use the string value of the context node. | string-length(‘hello’) |
| substring | A segment within a variable value. Substring takes three parameters: the input variable, the first character to be selected, and the length of the resulting string | substring($dob,4,2) |
| substring-after | The substring-after function returns a portion out of the string specified in the string argument that occurs after the substring specified in the substring argument. | substring-after(‘In 1814 we took a little trip’, ‘we’) |
| substring-before | The substring-before function returns a portion out of the string specified in the string argument that occurs before the substring specified in the substring argument. | substring-before(‘In 1814 we took a little trip’, ‘we’) |
| sum | The sum function adds and returns the total value of a set of numeric values in a node-set or list of values. | sum(1,3,7,12) |
| translate | Takes the string in the value argument, replaces all occurrences of a string specified in the string1 argument with substitute characters specified in string2 argument and returns the modified string. | translate(‘colored armor’, ‘or’, ‘our’) |
Read more about this topic: XSLT Elements
Famous quotes containing the words functions and/or defined:
“The English masses are lovable: they are kind, decent, tolerant, practical and not stupid. The tragedy is that there are too many of them, and that they are aimless, having outgrown the servile functions for which they were encouraged to multiply. One day these huge crowds will have to seize power because there will be nothing else for them to do, and yet they neither demand power nor are ready to make use of it; they will learn only to be bored in a new way.”
—Cyril Connolly (19031974)
“A Tory..., since the revolution, may be defined in a few words, to be a lover of monarchy, though without abandoning liberty; and a partizan of the family of Stuart. As a Whig may be defined to be a lover of liberty though without renouncing monarchy; and a friend to the settlement in the protestant line.”
—David Hume (17111776)