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

Variables and parameters

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Thu, 11 May 2006 15:04:52 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <874pzw8jsb.fsf@nwalsh.com>
Similar to the ideas we discussed today, here's my vision for
parameters and variables. I think we want to allow variables
to be set either as literals or as XPath expressions. Syntactically,
there are probably a few ways we could do this, for the moment I'm
going to use a 'value' attribute for literal values and a select
attribute for XPath expressions:

  <p:param name="foo" value="foo"/>
  <p:param name="bar" select="'bar'"/>
  <p:param name="six" select="2+4"/>

I assume that top level variables can be specified by the user (on a
command line, through some API, whatever). Of the variables that
remain unspecified, I propose that that they be evaluated in order.
Each XPath expression is evaluated with the context node set to an
empty document and with the parameters previously declared in its
context. So this works:

  <p:param name="one" value="1"/>
  <p:param name="two" select="$one+$one"/>
  <p:parma name="three" select="$two+$one"/>

But this is an error:

  <p:parma name="three" select="$two+$one"/>
  <p:param name="two" select="$one+$one"/>
  <p:param name="one" value="1"/>

Parameters specified on a component are evaluated by default with the
context node an empty document and the parameters "in scope" available
as variables.

  <p:step name="something">
    <p:param name="limit" select="$three+$two"/>

Optionally, parameters can specify the document that should be the
context node for evaluation:

    <p:param name="destination" ref="somelabel" select="/*/@label"/>

The value of the parameter is always string($expr).

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Thursday, 11 May 2006 19:05:04 GMT

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