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

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

From: Alex Muir <alex.g.muir@gmail.com>
Date: Thu, 9 Aug 2012 10:25:07 -0400
Message-ID: <CAFtPEJZWCjxdtQUhBkivzAORoD0YFGwLydv6eScq89Luxcn1Dw@mail.gmail.com>
To: XProc Dev <xproc-dev@w3.org>
Hi,
I've declared a simple step to output some specific logging, in this case a
message and a count.

I'm trying to add into it a p:choose, which given an option log, which I'm
currently just setting to false for testing, will or or will not output the
cx:message.  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:

SEVERE: err:XS0032:Input source unbound on p:identity step named ident and
no default binding available.
Aug 09, 2012 10:18:30 AM com.xmlcalabash.drivers.Main error
SEVERE: It is a static error if no connection is provided and the default
readable port is undefined.

I get the error message however I've tried a number of other ways to do
this and can't get it working.

So how do I write this convenience step which should log or not log given a
boolean value without getting an exception?

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

  <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>

    <cx:message>
     <p:with-option name="message" select="'else'"/>     <!-- Would like to
sink here instead of logging but I get an exception -->
    </cx:message>

   </p:otherwise>
  </p:choose>

  <p:identity name="ident"/>
 </p:declare-step>


High Regards
Thanks
-- 
-

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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 9 August 2012 14:25:34 GMT