Neil,

It will work with text, but you have to do a little more work. cts:highlight() 
wants an element or document node, so you can wrap your text in an element 
constructor as you pass it in, then go back to text on the way out:

let $doc :=
"I have some text that includes the words Doc, ume, and nt."

. . . .

return
 cts:highlight(element doc 
{$doc},$q,local:replace($cts:queries,$replace))/text()

I'm not sure about the rest of your question, but since you don't want to 
expand on it, I won't ask you to. :) As Geert suggests, CPF will let you work 
through a series of steps asynchronously, manage state transitions, etc, if 
that is an approach you'd like to consider. I hope I didn't confuse the subject 
by suggesting you store the queries as documents to manage your string 
replacing more efficiently. The idea is otherwise the same - documents are 
"enriched" one at a time by replacing multiple string values with a new value.

Kelly 

Message: 2
Date: Fri, 9 Oct 2009 15:37:39 +0100
From: "Neil Bradley" <[email protected]>
Subject: RE: [MarkLogic Dev General] RE: Text Updates Garbage
        Collection?     (Neil   Bradley)
To: "'General Mark Logic Developer Discussion'"
        <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain;       charset="us-ascii"

Kelly,

Does that approach work with text documents? 

Another issue is that, for reasons I do not want to expand on here, we want to 
process one document at a time through the step discussed here along with other 
prior and following steps, so I am not sure the benefits of this approach over 
the fn:replace() function. But it is certainly a interesting alternative. 

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

Reply via email to