W3C home > Mailing lists > Public > xproc-dev@w3.org > May 2009

Re: Detecting unbound options

From: mozer <xmlizer@gmail.com>
Date: Wed, 27 May 2009 18:49:02 +0200
Message-ID: <21d9ade60905270949y38973b3ew52895c69cb32e113@mail.gmail.com>
To: Norman Walsh <ndw@nwalsh.com>
Cc: XProc Dev <xproc-dev@w3.org>
Norm,


On Wed, May 27, 2009 at 4:06 PM, Norman Walsh <ndw@nwalsh.com> wrote:
> "Henry S. Thompson" <ht@inf.ed.ac.uk> writes:
>>> Yuck! But can we really live with this...
>>
>> For sure not.
>>
>> The most straightforward approach would be to add p:bound? as an XPath
>> extension function.
>
> Alas, I think that would just trade a great big nested p:try/p:catch
> for a great big p:choose...

A small win, but a win !

Let's try to solve your use case

Here are the ways to solve it with the lesser code
1) First, is to say that selecting an unbound variable will generate
un unbound variable (a bit tricky)
2) To add an attribute on p:with-option that says
@bound-like-this-option="$foo" ; if foo is bound then the variable
will be bound and the value will be the content of the select and will
not be bound if $foo isn't bound

In this case you just have to write


<p:directory-list>
 <p:with-option name="path" select="$path" bound-like-this-option="$path">
   <p:empty/>
 </p:with-option>
 <p:with-option name="include-filter" select="$include-filter"
bound-like-this-option="$include-filter">
   <p:empty/>
 </p:with-option>
 <p:with-option name="exclude-filter" select="$exclude-filter"
bound-like-this-option="$exclude-filter">
   <p:empty/>
 </p:with-option>
</p:directory-list>

We eventually need to come up with a better name for this attribute

Xmlizer
Received on Wednesday, 27 May 2009 16:50:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 May 2009 16:50:08 GMT