XPath Functions | Example | Description |
ARITHMETIC FUNCTIONS |
ceiling | ceiling(14 div 3) = 5 | Returns the smallest integer greater than or equal to the numeric value of the argument. |
floor | floor(4.5) = 4 | Returns the largest integer less than or equal to the numeric value of the argument. |
round | round(9.6) = 10 | Returns the closest integer to the numeric value of the argument. |
BOOLEAN FUNCTIONS |
false | xsl:if test=false() | Returns the Boolean false. |
true | xsl:if test=true() | Returns the Boolean true. |
not | not(false()) returns true | Returns the Boolean negation of its argument. |
CONTEXT INFORMATION FUNCTIONS |
current | If @LastName is the context node current() returns a one-node node set of @LastName's value. | Returns the context node. |
last | <xsl:if test="position() != last()" </xsl:if> | Returns the number of the last node in the node set. |
position | <xsl:if test="position() < 3" </xsl:if> | Returns the number of the thecurrent node in the node set. |
DATA CONVERSION FUNCTIONS |
boolean | Boolean(0) returns false | Converts the argument to a Boolean value. |
format-number | format-number (value, format) produces a formatted string. | Converts numbers to strings for display. The format is controlled by decimal-format. |
number | number('-32.4') returns -32.4 as a number. | Converts its argument to a number. |
string | string(-32.4) returns '-32.4'. | Converts its argument to a string. |
PROCESSOR INFORMATION FUNCTIONS |
element-available | <xsl:element-available ('xsl:comment') returns true. | Tests whether a specific controlled instruction or extension is available. |
function-available | <xsl:function-available ('string') returns true. | Tests whether a specific XSLT function or extension is available. |
RETRIEVING NAMES AND IDS FUNCTIONS |
name | <xsl:if test="not(@LastName)"> </xsl:if | Returns a Qname representing a node name. |
STRING FUNCTIONS |
concat | <xsl:value-of select="concat('address', 'city', 'state', 'zip')" /> | Joins two or more arguments as strings. |
contains | contains('Winston', 'ton') returns true. | Tests whether a string is contained within another string. |
string-length | string-length('four score') returns 10. | Returns the character count in a string. |
substring | substring('four score', 2, 3) returns 'our'. | Returns a portion of a string based on position attributes starting at 1. |
SUMMARY FUNCTIONS |
count | if test="count('resume/address [zip]') != 0" | Returns the number of nodes in a node set. |
sum | the node <tri a='10' b='20' c='30' Returns 60 with the expression sum(@*) | Calculates the total of a set of numbers in a node set. |