W3C home > Mailing lists > Public > xproc-dev@w3.org > August 2012

Re: To cx:message or not cx:message, that is the exception?

From: Alex Muir <alex.g.muir@gmail.com>
Date: Thu, 9 Aug 2012 13:15:39 -0400
Message-ID: <CAFtPEJb0VCaEmfBoY1mhnHpzs1TXfMRTzVbcFdbZVU+ponCD1w@mail.gmail.com>
To: Florent Georges <fgeorges@fgeorges.org>
Cc: XProc Dev <xproc-dev@w3.org>
Thanks,, Figured it out.. Had to stop piping the identity into the output
port

 <p:declare-step name="counter" type="mh:counter">
  <p:input port="source" primary="true"/>
  <p:output port="result" sequence="true"/>


  <p:option name="log" select="'false'"/>
  <p:option name="step-name" required="true"/>
  <p:option name="count" required="true"/>
  <p:option name="message" required="true"/>

  <p:choose>
   <p:when test="$log = 'true'">
    <cx:message>
     <p:with-option name="message" select="concat('        COUNTER:  ',
$message, '     ', $count)"/>
    </cx:message>
   </p:when>
   <p:otherwise>
    <p:identity name="ident"/>
   </p:otherwise>
  </p:choose>

 </p:declare-step>

On Thu, Aug 9, 2012 at 11:54 AM, Florent Georges <fgeorges@fgeorges.org>wrote:

> On 9 August 2012 15:25, Alex Muir wrote:
>
>   Hi,
>
> > The following which in the otherwise is outputting a log
> > message works, although it's not what I want.  I would like to
> > <p:sink/> in the otherwise or do nothing basically however then
> > I get the error messages:
>
>   I have not read into great details, but it seems you want to
> return an empty document.  If your step declares to return a
> document, then it has to.  Because p:sink has no output at all,
> it is an error then.  What you want (if I understood correctly)
> is rather:
>
>     <p:identity>
>        <p:input port="source">
>           <p:empty/>
>        </p:input>
>     </p:identity>
>
>   Note that this is not the same thing as p:sink: it returns
> something, but this is empty.  In some projects I used that
> extensively, so I create 2 utility steps:
>
>     <p:declare-step type="app:empty">
>        <p:output port="result" primary="true"/>
>        <p:identity>
>           <p:input port="source">
>              <p:empty/>
>           </p:input>
>        </p:identity>
>     </p:declare-step>
>
>     <p:declare-step type="app:nothing">
>        <app:empty/>
>        <p:sink/>
>     </p:declare-step>
>
>   Regards,
>
> --
> Florent Georges
> http://fgeorges.org/
> http://h2oconsulting.be/
>



-- 
-

Alex G. Muir
Software Engineering Consultant
Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125
Received on Thursday, 9 August 2012 17:16:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 9 August 2012 17:16:07 GMT