Re: V.next idea: option/parameter typing and error handling

Alex,

Are you asking for this

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
exclude-inline-prefixes="c xs"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
xpath-version="2.0">
  <p:output port="result"/>
  <p:group>
    <p:choose>
      <p:variable name="a" select="'2012-02-30'"/>
      <p:when test="$a castable as xs:date">
        <p:identity>
          <p:input port="source">
            <p:inline>
              <the-variable-is-castable-as-date/>
            </p:inline>
          </p:input>
        </p:identity>
      </p:when>
      <p:otherwise>
        <p:identity>
          <p:input port="source">
            <p:inline>
              <the-variable-is-NOT-castable-as-date/>
            </p:inline>
          </p:input>
        </p:identity>
      </p:otherwise>
    </p:choose>
  </p:group>
</p:declare-step>

Mohamed
On Tue, Jan 31, 2012 at 3:50 PM, Alex Milowski <alex@milowski.com> wrote:
> Also, as I'm binding certain typed values to options (e.g. pulling a
> start time off the query parameters), I'd really like an easy way to
> say:
>
>  "This option is typed as xs:dateTime.  If the value does not cast
> properly, run this other part of the pipeline."
>
> One simple way we could accomplish this is to allow type errors within
> a certain portion of the pipeline to be caught and processed somehow.
>
> --
> --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
>
>



-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 €

Received on Wednesday, 1 February 2012 14:32:39 UTC