On Wed, 17 Jun 2009 08:26:02 -0700, Runstein, Robert E. (Contr) (IS) <[email protected]> wrote:

Hi,

Should a state-transition call the success-action when the state matches
but the condition returns false?  I'm seeing this behavior and it causes
the document to transition to the on-success state.  The action does not
fire.  If this is expected, then it seems that the only way to prevent a
state transition on a document is for the document's current state not
to match the state specified in the state-transition.  Is that correct?
Thanks.

Bob

The success-action is always called to advance the state unless there was an
error, in which case the failure-action is called.   If a document enters
a state, then, yes, the state transition on it is always acted upon (provided there
is one).

If you are trying to perform some kind of branch, so that some documents
run through one series of states, and some documents run through some
different series of states, then you can use the pre-defined state-setting-action. Here is an example from the conversion pipeline: it will send XHTML content off on its own set of operations and advance everything else to "converted". You
could also have an N-way branch with a whole series of condition/action
pairs (if its an X go to do-X-things-state, if its a Y go to do-Y-things-state,
if its a Z go to do-Z-things-state).

 <state-transition>
      <annotation>
      Vector off XHTML content to the next phase, post-conversion cleanup.
      Otherwise, drop down to the converted state.
      </annotation>

      <state>http://marklogic.com/states/initial</state>
      <on-success>http://marklogic.com/states/converted</on-success>
      <on-failure>http://marklogic.com/states/error</on-failure>
      <priority>9900</priority>

      <execute>
         <annotation>Testing for XHTML has to be via the namespace.
         Documents of type text/html are excluded because they are handled
         by HTML pipeline.
         </annotation>
         <condition>
            <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy">
               <namespace>xhtml</namespace>
               <exclude-mime-type>text/html</exclude-mime-type>
            </options>
         </condition>
         <action>
            <module>/MarkLogic/cpf/actions/state-setting-action.xqy</module>
<options xmlns="/MarkLogic/cpf/actions/state-setting-action.xqy">
               <state>http://marklogic.com/states/xhtml</state>
            </options>
         </action>
      </execute>
   </state-transition>

//Mary

[email protected]
Principal Engineer
Mark Logic Corporation


_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to