Hi Mary, et al,
Thanks for the tidbit. The structure of my pipeline definition is a little different. Here's an example with a couple of questions: <?xml-stylesheet href="/cpf/pipelines.css" type="text/css"?> <pipeline xsi:schemaLocation="http://marklogic.com/cpf/pipelines pipelines.xsd" xmlns="http://marklogic.com/cpf/pipelines" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <pipeline-name>CPF Options Test</pipeline-name> <pipeline-description>Test options in CPF</pipeline-description> <success-action> <module>/MarkLogic/cpf/actions/success-action.xqy</module> </success-action> <failure-action> <module>/MarkLogic/cpf/actions/failure-action.xqy</module> </failure-action> <state-transition> <annotation>CPF Options Test</annotation> <state>http://marklogic.com/states/initial</state> <on-success>http://marklogic.com/states/final</on-success> <on-failure>http://marklogic.com/states/error</on-failure> <default-action> <module>/test-cpf.xqy</module> <options> <insert>false</insert> </options> </default-action> </state-transition> <state-transition> <annotation>CPF Options Test</annotation> <state>http://marklogic.com/states/updated</state> <on-success>http://marklogic.com/states/final</on-success> <on-failure>http://marklogic.com/states/error</on-failure> <default-action> <module>/test-cpf.xqy</module> <options> <insert>false</insert> </options> </default-action> </state-transition> </pipeline> 1. Am I adding the options in the correct part of the XML document given that I don't have an execute section? 2. Can I specify options without a module namespace? 3. Are the <destination-root/> and <destination-collection/> elements required? 4. Is it as simple as reading the value of $options/insert in my module? I am building toward testing this, but I want to avoid endless iterations if I'm just not applying it correctly. Thank you! Tim -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mary Holstege Sent: Tuesday, June 01, 2010 2:35 PM To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] Passing global external variables to adomain pipeline action handler 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
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
