Function Calls

Function calls are another building block of queries. A typical function call might look like:

substring($prodName, 1, 5)

where the name of the function is substring and there are three arguments, separated by commas and surrounded by parentheses. The first argument is a variable reference, whereas the other two are numeric literals.

The XQuery language has over 100 built-in functions, detailed in Appendix A. Chapter 8 explains the details of how to read function signatures and call them. It also explains how to define your own functions.

Get XQuery 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.