home contribute faq download

FunctX XSLT Functions

fn:count

The number of items in a sequence

Google
Webxsltfunctions.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('http://www.functx.com/input/order.xml')"/>
XSLT ExampleResults
<count(>ount( (1, 2, 3) )
<3>
<count($ordDoc>ount($ordDoc//item)
<6>
<count(>ount(
   distinct-values($ordDoc//item/@num))
<4>
<count(>ount( (1, 2, 3, () ) )
<3>
<count(>ount( () )
<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