First look is that you have a syntax error, you forgot a "return"

return xdmp:document-insert(fn:concat("/policies/","123.xml"),
$transformed_doc),

John

On Fri, Aug 9, 2013 at 2:07 PM, Singh, Gurbeer <
[email protected]> wrote:

>   ** **
>
> I am trying to set up a new pipeline , where once doc is converted into
> XML, I am want to add some metadata and want to move it to another folder ,
> but its below giving error ****
>
> ** **
>
> Error I am getting ****
>
> ** **
>
> 2013-08-09 13:56:01.424 Debug: ~OnDiskStand
> /d/vi5tas01/d1/MarkLogic-Data/Forests/qaPolicyPortalForest/00000021****
>
> 2013-08-09 13:56:03.685 Info: Deleted 5 MB in 1 sec at 353 MB/sec
> /d/vi5tas01/d1/MarkLogic-Data/Forests/qaPolicyPortalForest/00000020****
>
> 2013-08-09 13:56:03.696 Info: Deleted 35 MB in 1 sec at 3787 MB/sec
> /d/vi5tas01/d1/MarkLogic-Data/Forests/qaPolicyPortalForest/00000021****
>
> 2013-08-09 14:02:20.402 Debug: InMemoryStand
> /d/vi5tas01/d1/MarkLogic-Data/Forests/qaPolicyPortalForest/00000023,
> disk=30MB, memory=1310MB, list=1024MB, tree=256MB, rangeIndex=16MB,
> reverseIndex=16MB****
>
> 2013-08-09 14:02:34.185 Debug: Retrying xdmp:invoke 14007537527330427333
> Update 1 because XDMP-DEADLOCK: Deadlock detected locking
> qaPolicyPortalForest
> /docsIn/AsiaGLSThaiNPLOperationsProceduresV5.0_pdf_parts/conv.css****
>
> 2013-08-09 14:03:02.974 Info: TaskServer: [Entered Pipeline
> isDocumentXML.xqy] returning
> /docsIn/AsiaGLSThaiNPLOperationsProceduresV5.0_pdf.xml****
>
> 2013-08-09 14:03:02.974 Info: TaskServer: [isDocumentXHTML.xqy] returning
> true for /docsIn/AsiaGLSThaiNPLOperationsProceduresV5.0_pdf.xml****
>
> 2013-08-09 14:03:02.975 Error: TaskServer: qaPolicyPortalDB:
> on-state-enter /docsIn/AsiaGLSThaiNPLOperationsProceduresV5.0_pdf.xml
> action failed****
>
> 2013-08-09 14:03:02.977 Error: TaskServer: qaPolicyPortalDB: cpf:failure
> /docsIn/AsiaGLSThaiNPLOperationsProceduresV5.0_pdf.xml executing
> http://marklogic.com/states/converted****
>
> ** **
>
> ** **
>
> Piplene  code ****
>
> ** **
>
> <?xml version="1.0" encoding="UTF-8"?>****
>
> <?xml-stylesheet href="/cpf/pipelines.css" type="text/css"?>****
>
> <pipeline 
> xsi:schemaLocation="http://marklogic.com/cpf/pipelinespipelines.xsd"; xmlns="
> http://marklogic.com/cpf/pipelines"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";>****
>
>   <pipeline-name>Policy Portal Pipeline</pipeline-name>****
>
>   <pipeline-description> ** **
>
>      Takes all type of document, specially PDF doc docx  and append
> metadata data and copied it to policies otherdocs folder****
>
>    </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>****
>
>     <state>http://marklogic.com/states/converted</state>****
>
>     <on-success>http://marklogic.com/states/nonPolicy</on-success>****
>
>     <on-failure>http://marklogic.com/states/error</on-failure>****
>
>     <priority>5000</priority>****
>
>     <execute>****
>
>       <condition>****
>
>
> <module>/MarkLogic/cpf/actions/wordToMSSchema/isDocumentXML.xqy</module>**
> **
>
>       </condition>****
>
>       <action>****
>
>
> <module>/MarkLogic/cpf/actions/wordToMSSchema/addMetaPolicyDoc.xqy</module>
> ****
>
>       </action>****
>
>     </execute>****
>
>   </state-transition>****
>
>   <!-- Final states (final and error) are not handled here -->****
>
> </pipeline>****
>
> ** **
>
> *isDocumentXML Code *
>
> ** **
>
> xquery version "1.0-ml";****
>
> declare namespace cpf = "http://marklogic.com/cpf";****
>
> declare namespace prop="http://marklogic.com/xdmp/property";****
>
> declare namespace lnk="http://marklogic.com/cpf/links";****
>
> ** **
>
> declare variable $cpf:document-uri as xs:string external;****
>
> (****
>
>                 try****
>
>                 {****
>
>                                 (****
>
>                                                 let $log :=
> xdmp:log(fn:concat("[Entered Pipeline isDocumentXML.xqy] returning ",
> $cpf:document-uri))****
>
>                                                 let $retval :=
> fn:ends-with($cpf:document-uri, "xml")****
>
>                                                 let $log :=
> xdmp:log(fn:concat("[isDocumentXHTML.xqy] returning ", $retval, " for ",
> $cpf:document-uri))****
>
>                                                 return $retval****
>
>                                 )****
>
>                 }****
>
>                 catch ($e) ** **
>
>                 {****
>
>                                 xdmp:log($e)****
>
>                 }****
>
> )****
>
> ** **
>
> *addMetaPolicyDoc code *
>
> xquery version "1.0-ml";****
>
> declare namespace xhtml="http://www.w3.org/1999/xhtml";****
>
> import module namespace cpf = "http://marklogic.com/cpf"; at
> "/MarkLogic/cpf/cpf.xqy";****
>
> import module namespace op = "
> http://www.marklogic.com/OOXML/ooxml2Policy.xqy"; at
> "/MarkLogic/cpf/actions/delivery/modules/ooxml2Policy.xqy";****
>
> import module namespace s2ms = "
> http://www.marklogic.com/morganStanley/modules/structToMSSchema.xqy"; at
> "/MarkLogic/cpf/actions/delivery/modules/structToMSSchema.xqy";****
>
> import module namespace td = "
> http://www.marklogic.com/morganStanley/modules/tagDocs.xqy"; at
> "/MarkLogic/cpf/actions/delivery/modules/tagDocs.xqy";****
>
> declare namespace struct="http://www.marklogic.com/jetblue/docStructure";*
> ***
>
> declare namespace w="
> http://schemas.openxmlformats.org/wordprocessingml/2006/main";****
>
> declare variable $cpf:document-uri as xs:string external;****
>
> declare variable $cpf:transition as node() external;****
>
> declare variable $cpf:options as node() external;****
>
> (****
>
>   xdmp:log("Entered addMetaPolicyDoc addMetaPolicyDoc.xqy "),****
>
> ** **
>
>   if (cpf:check-transition($cpf:document-uri, $cpf:transition)) then****
>
>     try****
>
>     {****
>
>       (****
>
>                                                 let $t :=
> xdmp:log(fn:concat("doc uri: ",$cpf:document-uri))****
>
>                                                 let $t :=
> xdmp:log(fn:concat("transacatio: ",xdmp:quote($cpf:transition)))****
>
> ** **
>
>                                                 let $transformed_doc :=
>               ****
>
>
> <recordDetails> ****
>
>
> <abc><name>gurbeer</name></abc>****
>
>
> <content>{fn:doc($cpf:document-uri)}</content>****
>
>
> </recordDetails>****
>
>
> xdmp:document-insert(fn:concat("/policies/","123.xml"), $transformed_doc),
> ****
>
>
> cpf:success($cpf:document-uri, $cpf:transition, ()),****
>
>
> xdmp:log(fn:concat("","Exiting addMetaPolicyDoc"))****
>
>       )****
>
> ** **
>
>     } ****
>
>     catch ($e) ****
>
>     {****
>
>                                                 xdmp:log($e),****
>
>
> cpf:failure($cpf:document-uri, $cpf:transition, $e, ())****
>
>     }****
>
>   else****
>
>                         ( ** **
>
>                                                 xdmp:log("Exiting else
> addMetaPolicyDoc.xqy") ****
>
>                         )****
>
> )****
>
>
> ------------------------------
>
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the
> opinions or views contained herein are not intended to be, and do not
> constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall
> Street Reform and Consumer Protection Act. If you have received this
> communication in error, please destroy all electronic and paper copies and
> notify the sender immediately. Mistransmission is not intended to waive
> confidentiality or privilege. Morgan Stanley reserves the right, to the
> extent permitted under applicable law, to monitor electronic
> communications. This message is subject to terms available at the following
> link: http://www.morganstanley.com/disclaimers If you cannot access these
> links, please notify us by reply message and we will send the contents to
> you. By messaging with Morgan Stanley you consent to the foregoing.
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to