Description
The fn:count function returns the number of items in a sequence, as an xs:integer .
This description is © Copyright 2007, Priscilla Walmsley. It is excerpted from the book XQuery by Priscilla Walmsley, O'Reilly, 2007. For a complete explanation of this function, please refer to Appendix A of the book. Arguments and Return TypeName | Type | Description |
$arg |
item()* |
the sequence of items to count |
return value |
xs:integer |
Examples<xsl:variable name="ordDoc" select="doc('https://www.datypic.com/functx./input/order.xml')"/>
|
XPath Example | Results |
---|
count( (1, 2, 3) ) |
3 |
count($ordDoc//item) |
6 |
count(
distinct-values($ordDoc//item/@num)) |
4 |
count( (1, 2, 3, () ) ) |
3 |
count( () ) |
0 |
See Alsofn:sum | The sum of values in a sequence |
History |
Recommended Reading:
|