XPath Functions

You can use all of the standard XPath 1.0 functions, in addition Tabular extends the default function set by leveraging string manipulation and PHP’s registerphpfunctions method of the DOM XPath class. This chapter documents the default functions.

average

Return the average value of a set of (numerical) node values.

Arguments:

  • selector: Selector for cell values.

Example:

average(//price)

Will return the average price.

deviation

Return the deviation as a percentage between two values

Example:

deviation(10, 20)

Would return “100” because 20 is 100% more than 10.

This can also be used effectively with average function:

deviation(average(//price), ./price)

Will show the deviation of the price from the average value.

max

Return the maximum value of a set of (numerical) node values.

Example:

max(//price)

Will return the minimum price.

median

Return the median value of a set of (numerical) node values.

Example:

median(//price)

Will return the median price.

min

Return the minumum value of a set of (numerical) node values.

Example:

min(//price)

Will return the minimum price.