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>
Leigh,

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
nick.van.den.bleeken@inventivegroup.com<mailto:nick.van.den.bleeken@inventivegroup.com>
www.inventivedesigners.com


[cid:image001.png@01CBF2F8.1DA19110][cid:image002.png@01CBF2F8.1DA19110][cid:image003.png@01CBF2F8.1DA19110]

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.

Example:

<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()"/>

Leigh.


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



________________________________

Inventive Designers' Email Disclaimer:
http://www.inventivedesigners.com/email-disclaimer



image001.png
(image/png attachment: image001.png)

image002.png
(image/png attachment: image002.png)

image003.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, 1 October 2013 22:06:56 UTC