Detecting unbound options

"Henry S. Thompson" <ht@inf.ed.ac.uk> writes:
> So, if I want to detect and handle specially the case where an
> optional option has not been specificed, how can I do so?

You can't. And you know this bites harder than I realized.

Consider the beginnings of a recursive directory listing step:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
		xmlns:c="http://www.w3.org/ns/xproc-step"
		xmlns:pxp="http://exproc.org/proposed/steps"
		type="pxp:recursive-directory-list">
<p:output port="result"/>
<p:option name="path" required="true"/>
<p:option name="include-filter"/>
<p:option name="exclude-filter"/>

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

</p:declare-step>

Using four nested p:try/p:catch blocks to deal with the various permutations
of $include-filter and $exclude-filter being defined or undefined seems 
pretty brutal.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | A man may by custom fortify himself
http://nwalsh.com/            | against pain, shame, and suchlike
                              | accidents; but as to death, we can
                              | experience it but once, and are all
                              | apprentices when we come to it.--
                              | Montaigne

Received on Tuesday, 26 May 2009 23:22:07 UTC