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

Another thing for V.next: testing/defaulting for unbound options

From: Alex Milowski <alex@milowski.com>
Date: Tue, 31 Jan 2012 14:39:56 +0000
To: XProc WG <public-xml-processing-model-wg@w3.org>
Message-ID: <E1RsH44-0002v9-H0@lisa.w3.org>
I am often pulling option values off of bindings to HTTP requests.  As
such, there are times when options just do not have values.  As such,
when the pipeline runs, the option is unbound and so does not exist.

That means I can't write something like:

<p:with-param name="start" select="if (p:value-available('start'))
then $start else current-dateTime()"/>

and instead I have to restructure my xproc to check for the value and
ensure it has a value:

<p:choose>
   <p:when test="p:value-available('start')"> ... </p:when>
   ...
</p:choose>

Re-writing is certainly overkill.  It often means that I have to
create weird steps that use p:choose to output the value and then use
a select expression later on to get that value.

I'm not certain what the right solution here is in that an unbound
option causes the variable binding to not be in scope.  As such, you
get a syntax error in the expression.

Norm has suggested to me that we could default to binding options to
() (the empty sequence) in V.next.

-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics
Received on Tuesday, 31 January 2012 17:00:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 31 January 2012 17:00:18 GMT