home contribute faq download

FunctX XSLT Functions

fn:count

The number of items in a sequence

Google
Webdatypic.com

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 Type

NameTypeDescription
$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 ExampleResults
count( (1, 2, 3) )
3
count($ordDoc//item)
6
count(
   distinct-values($ordDoc//item/@num))
4
count( (1, 2, 3, () ) )
3
count( () )
0

See Also

fn:sumThe sum of values in a sequence

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XSLT Services

Recommended Reading:

XQuery