And if you want to limit the words you are adding to a single document, you can 
use the $query parameter to cts:words and specify a cts:document-query to limit 
the cts:words call to a single document.  For example:

cts:words("a",  ("collation=http://marklogic.com/collation/","ascending";),
          cts:document-query("/theuri.xml") )

-Danny

-----Original Message-----
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Mary Holstege
Sent: Monday, October 19, 2009 8:26 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Loading words in a XML file into Dictionary

On Mon, 19 Oct 2009 00:32:37 -0700, Selven Xavier  
<selvenxavie...@gmail.com> wrote:

> We are planning to implement the below functionality using CPF.
>
> We have used word lexicon to load all the words into the Dictionary file  
> as
> shown in below code snippets.  Here the word lexicon has all the words  
> of an
> xml file in that database. But we need only the words present in an xml  
> file
> [i.e. not from all the files from the database] which is dragged and  
> dropped
> into database through webdav.
>
> if (cpf:check-transition($cpf:document-uri,$cpf:transition)) then
>    spell:add-word("/small-dictionary.xml",
>             cts:words("a",
>                         ("collation=http://marklogic.com/collation/
> ","ascending")
>             )
>    )
> else ()
>
>

Be sure to include the calls to cpf:success and cpf:failure, too.

> Is there any efficient way, we can load only the words in a XML file into
> Dictionary? If so, can you please suggest us how to resolve the above
> problem.

In your pipeline you can add a condition:

    <state-transition>
       <state>your-state-here</state>
       <on-success>your-success-state-here</on-success>
       <on-failure>your-failure-state-here</on-failure>

       <execute>
          <condition>
             <module>/MarkLogic/cpf/actions/format-condition.xqy</module>
             <options xmlns="/MarkLogic/cpf/actions/format-condition.xqy">
                <format>xml</format>
             </options>
          </condition>
          <action>
             <module>your-module-here</module>
          </action>
       </execute>
    </state-transition>

//Mary

mary.holst...@marklogic.com
Principal Engineer
Mark Logic Corporation
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general

Reply via email to