On Tue, 01 Jun 2010 10:29:34 -0700, Tim Meagher <[email protected]> wrote:

> Hi Folks,
>
>
> I would like to pass one or more variables to a pipeline's action module
> that is handling documents, similar to passing global external variables  
> to
> a module.  Is that something I need to do with $cpf:options?  How would  
> I go
> about doing that?

The $cpf:options variable is set to be the options node in the pipeline
definition.  You can see examples in conversion pipelines, such as this:

<state-transition>
    <annotation>Convert the PDF.</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>9400</priority>

    <execute>
       <condition>
          <module>/MarkLogic/cpf/actions/mimetype-condition.xqy</module>
          <options xmlns="/MarkLogic/cpf/actions/mimetype-condition.xqy">
             <mime-type>application/pdf</mime-type>
          </options>
       </condition>
       <action>
          <module>/MarkLogic/conversion/actions/convert-pdf-action.xqy</module
          <options  
xmlns="/MarkLogic/conversion/actions/convert-pdf-action.xqy
             <destination-root/>
             <destination-collection/>
             <wrap xmlns="xdmp:tidy">0</wrap>
             <tidy-mark xmlns="xdmp:tidy">false</tidy-mark>
             <show-warnings xmlns="xdmp:tidy">false</show-warnings>
             <line-breaks xmlns="xdmp:pdf-convert">false</line-breaks>
          </options>
       </action>
    </execute>
</state-transition>

On the action side you declare the external variable $cpf:options
and then pluck what you want from it using path expressions.  So, for
example, given a namespace declaration "pdf" for the namespace  
"xdmp:pdf-convert"
fn:data($cpf:options/pdf:line-breaks) gives the value "false" (actually  
false() in this
case because there is a schema for this).

//Mary

[email protected]
Principal Engineer
Mark Logic Corporation
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to