cascavel
cascavel

Reputation: 55

What does a hash (#) followed by a number mean in XSLT?

For example, the #1 in:

f:is-subordinate($M, $E, f:direct-reports#1)

from http://www.w3.org/TR/xslt-30/#d7e22590

Upvotes: 3

Views: 2173

Answers (2)

Ian Roberts
Ian Roberts

Reputation: 122374

The example you point to is a higher-order function that takes another function as a parameter. The f:direct-reports#1 denotes the function named f:direct-reports that takes 1 argument - the number after the hash is referred to as the function's arity - and this function#arity syntax is the way you refer to the function itself as a first-class object, as opposed to calling the function and making use of its return value.

Upvotes: 2

zessx
zessx

Reputation: 68790

This is called the arity, and it's the number of parameters required by a function. If you don't have any hash (#), the arity of the function is 0.

Here, it refers to a direct-reports function which take a single parameter.

With arity, you can have several functions with the same name, but a number of parameters which differs.

Upvotes: 4

Related Questions