W3C home > Mailing lists > Public > public-forms@w3.org > March 2012

Re: Custom functions (Major re-write, please review)

From: Nick Van den Bleeken <Nick.Van.den.Bleeken@inventivegroup.com>
Date: Wed, 14 Mar 2012 15:05:02 +0000
To: "Leigh L. Klotz, Jr." <Leigh.Klotz@Xerox.com>
CC: "<public-forms@w3.org>" <public-forms@w3.org>
Message-ID: <8189AF24-85D8-4ABB-9201-B23D76EEF2F0@inventivegroup.com>

As Michael Kay pointed out "User-defined functions get no context item, position, or size. That's true both for named global functions and inline functions." so you won't be able to use position()not last() in the default context of your function body.

The variables in scope for the function body include all variables representing the function parameters, as well as all variables that are in scope for the inline function expression.

Note: Function parameter names can mask variables that would otherwise be in scope for the function body.

Kind regards,

Nick Van den Bleeken
R&D Manager

Phone: +32 3 425 41 02
Office fax: +32 3 821 01 71


On 14 Mar 2012, at 15:56, Leigh L. Klotz, Jr. wrote:

Nick Van den Bleeken writes:

So I think our custom functions also shouldn't do that. Now that we have variables you can work around this limitation.


<var name="context" value="."/>
<var name="context-pos" value="position()"/>
<var name="context-size" value="last()"/>
<function signature="my:f() as number" value="$context-pos = $context-size"/>

How does the scoping on this work?

Wouldn't you have to do this?

<function signature="my:f() as number" value="position() = last()"/>


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Inventive Designers' Email Disclaimer:

(image/png attachment: image001.png)

(image/png attachment: image002.png)

(image/png attachment: image003.png)

Received on Wednesday, 14 March 2012 15:05:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:14:06 UTC