- From: Jeremy Carroll <jjc@hpl.hp.com>
- Date: Tue, 19 Jun 2007 22:54:41 +0100
- To: Dan Connolly <connolly@w3.org>
- CC: GRDDL Working Group <public-grddl-wg@w3.org>
Dan Connolly wrote: > I dunno which is worse... a "please excuse the > copy-and-paste programming" comment or a "please > excuse the continuations contortions" comment. > Since I gather the continuation stuff is working, > I can live with the latter. > The Michael Kay reference is not so relevant; the history went something like, I tried an xsl:call-template with a variable as the template name (which isn't allowed) and arrived at that page in the book, and decided that since the variable only had two possible values, I could not completely inelegantly hack the continuation with an xsl:choose. I will add a comment above <xsl:template name="xa:if-relative-then-call-continuation"> <!-- If the $uri parameter is a relative URI, then this template calls a further template, indicated by the $continuation parameter. This is intended as following the functional programming paradigm of programming with continuations. The $continuation-param-value parameter indicates a parameter to be passed to the $continuation template. Given limitations of XSLT, the $continuation parameter has to be one that is explicitly supported by this template. These are: 'barf' and 'barf-if-relative' which call the templates with that local name in the xa namespace. The motivation for this style is to avoid copy/paste of the moderately complicated code that tests for relative URIs. Michael Kay briefly describes an alternative approach to continuation programming, in his book XSLT 2.0, Programmer's Reference, 3rd Edition, p198. The basic idea of the continuation style, is that when calling a function f you pass another function g as a first class object and this is used to continue, after f has finished. There are some cases in which f returns without calling g. --> Jeremy -- Hewlett-Packard Limited registered Office: Cain Road, Bracknell, Berks RG12 1HN Registered No: 690597 England
Received on Tuesday, 19 June 2007 21:55:14 UTC