Appendix F. XPath 2.0 Function Reference

This reference provides brief details of the XPath 2.0 functions. These are distinct from functions that apply only to XSLT, which are detailed in Appendix D.

For the authoritative source and for details of the XPath 2.0 operators, go to the W3C recommendation XQuery 1.0 and XPath 2.0 Functions and Operators at www.w3.org/TR/xpath-functions.

You will find further detailed information on the use of these functions, together with additional information on XPath 2.0, in Michael Kay's XSLT 2.0 and XPath 2.0 Programmer's Reference, Fourth Edition (Wrox, 2008).

Functions

abs

Purpose

Returns the absolute value of a number, with the same type as the input.

Signature

abs(value)

Parameter

Name

Description

Type

Use

value

The supplied value

xs:double | xs:float | xs:decimal | xs:integer

Required

avg

Purpose

Returns the average of a sequence of numbers or durations, with the same type as the input.

Signature

avg (sequence)

Parameter

Name

Description

Type

Use

sequence

The supplied value

xs:anyAtomicType

Required

adjust-date-to-timezone, adjust-dateTime-to-timezone, adjust-time-to-timezone

Purpose

Three functions that return a supplied date, datetime, or time, with an altered time zone.

Signature

adjust-date-to-timezone(value, timezone)

Parameters

Name

Description

Type

Use

value

The date, dateTime, or time to adjust

xs:date | xs:dateTime | xs:time

Required

timezone

The time-zone value

xs:dayTimeDuration

Optional

See also

implicit-timezone()

base-uri

Purpose

Returns the base URI of a given document node.

Signature ...

Get Beginning XSLT and XPath: Transforming XML Documents and Data now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.