W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > May 2006

Variables/Parameters and Scoping

From: Alex Milowski <alex@milowski.org>
Date: Thu, 18 May 2006 07:37:44 -0700
Message-ID: <446C86B8.2080803@milowski.org>
To: public-xml-processing-model-wg@w3.org

The one thing I have found very useful is the ability to select
content from an input and bind it to a parameter for some part of
a pipeline.  In my mind, parameters and "variables" are the same
thing.

In our proposed syntax, this would amount to a language structure that 
had some number of contained steps:

1. Each parameter would need to identify an on which the Xpath is
    evaluated.

2. A default input could be supplied by the language structure.

3. The parameter bindings would be in scope for only the contained
    steps.

4. The contained steps should be treated similar to an "if" or
    "for-each" structure except that they should always be performed.

For example:

<p:let default="input-1">

    <!-- binds the 'x' parameter for the contained steps -->
    <p:parameter name="x" value="blue"/>

    <!-- selects from the default input and binds it to 'y' -->
    <p:parameter name="y" select="/doc/title"/>

    <!-- selects from the specified input and binds it to 'z' -->
    <p:parameter name="z" input='input-2' select="/doc/@created"/>

    <p:step/>
    <p:step/>
    <p:step/>
</p:let>

The advantage of using a structure to control this is that the
binding has a well-defined scope.

Of course, we can rename this to whatever pleases the group.  "let" is
my choice with an obvious heritage.

--Alex Milowski
Received on Thursday, 18 May 2006 14:37:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:47 GMT