On Tue, 02 Dec 2008 06:27:51 -0800, NoviceInMarkLogic <[EMAIL PROTECTED]> wrote:

Hello All

I have been working with the Content Processing Framework and have a
query with respect to it.

Can I dynamically pass a variable to the options tag in the pipeline.

For eg., I have a condition

<condition>
            <module>/MarkLogic/cpf/actions/chk-condition.xqy</module>
            <options xmlns="/MarkLogic/cpf/actions/chk-condition.xqy">
               <language>abc</language>
            </options>
 </condition>

Can i dynamically change the value in the <sample> tag, which in turn
would be reflected in the corresponding action module..

By "dynamic" I assume you mean document-dependent, yes?

There is no built-in hook to do this in general, but you can get the
effect you want by having your condition look at properties on the
document in question, either as a the sole source of a parameter, or
as a source to use with the option setting as a default.  "Property"
here could be an actual property (xdmp:document-get-properties) or some
other piece of data or metadata associated with the document.

Example:

declare namespace cpf="http://marklogic.com/cpf";;
declare namespace my="http://example.com/my/special/stuff";;
declare variable $cpf:document-uri as xs:string external;

declare variable $special-sauce :=
   xdmp:document-get-properties($cpf:document-uri, xs:QName("my:sauce") );

... do something based on value of $special-sauce ...


It could be that some other step in the processing decided to add the
appropriate property to the document, or that may have occurred outside
of the scope of CPF processing entirely.  Or: whatever you would have
done to decide what the value of $special-sauce was in binding it into
the options node, can just as well be done inside the condition to make
the same decision.

If your problem is you are trying to interact with existing conditions
or (in this case, more likely) actions that already expect to get their
options directly from the options node (and from no other place), the
simplest way to proceed is to handle this with multiple states: one to
select which other state (based on some dynamic property of the document)
to vector to, and then a state for each selected configuration.  If
the range is too large and variable for this, then you are better off
creating your own condition, as per the example above.

Cheers

//Mary

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

Reply via email to