Function memoization
Colin Paul Adams <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "James" == James Fuller <[email protected]> writes: >> modified form, a proposal that Dimitre Novatchev originally >> requested for memomizing xsl:functions. >> The modification being that the memoization reqest be an >> extension instruction actually present within the xsl:function >> concerned (this seems to me necessary to preserve compliance >> with the specifications - user-defined data elements and >> extension attributes may not cause a different final result >> tree to be produced, and, in some cases, memoization of a >> function will do just that). James> I am interested in such a function as well. OK. I shall try to define it's semantics: func:memoize will be an extension instruction. No attributes. Only permitted contents is an xsl:fallback child. The instruction must be an immediate child of an xsl:function or func:function. Good style suggests placing this immediately after the xsl:params, or at the very end of the function body - but I do not think we need mandate any such placement (except xsl:param must come first, as now). An XSLT processor that supports func:memoize shall remember the results of any calls to functions marked with a call to func:memoize. If the function is called again with the same values for the arguments, it MUST return the remembered result. It MUST NOT re-execute the function body, as this can cause different results in some cases. -- Colin Adams Preston Lancashire