# saxon:memo-function

This attribute may be set on the `xsl:function` element. The permitted values are "yes" and "no". Specifying "yes" indicates that Saxon should remember the results of calling the function in a cache, and if the function is called again with the same arguments, the result is retrieved from the cache rather than being recalculated. Don't use this if the function has side-effects (for example, if it calls `saxon:assign`, or an extension function with side-effects). Don't use it if the function accesses context information such as the context node or `position()` or `last()`. And be careful if the function constructs and returns a temporary tree: the effect will be that the function returns the same tree each time, rather than a copy of the tree (this difference will only show up if you compare the identity of nodes in the two trees).

In Saxon 8.0, this was working on some functions but not others, depending on the way they were compiled. In 8.1, it should work on all functions.

Expand | Up Next