Yes, and I just found out you can cause the "form" perform to exit 
prematurely and do other unusual stuff using xdmp:set($cts:action, ...); 
a nice little performance enhancer if you only want to grab context 
around the first hit, say.

-Mike

On 03/07/2011 05:42 AM, John Snelson wrote:
> Hi Alex,
>
> That particular "function" in MarkLogic is not actually a function at
> all, but a "functional form" - that is, an expression that looks like a
> function. You're right that the third argument is evaluated, possibly
> multiple times, under a different context than function arguments would
> normally be executed under.
>
> John
>
> On 03/03/11 17:22, Alexander Boyd wrote:
>    
>> I’m running the following code snippet in CQ:
>>
>> cts:highlight(
>>
>> <bogus>This is a test sentence to test this out.</bogus>,
>>
>> "test",
>>
>> <searchHit>{fn:upper-case($cts:text)}</searchHit>
>>
>> )
>>
>> This results in the following, which makes sense as per the API
>> documentation for cts:highlight:
>>
>> <bogus>This is a<searchHit>TEST</searchHit>  sentence to
>> <searchHit>TEST</searchHit>  this out.</bogus>
>>
>> What’s confusing me about this is that the evaluation of the third
>> argument to cts:highlight appears to be deferred until cts:highlight is
>> actually running, since $cts:text doesn’t appear to exist outside of a
>> call to cts:highlight. Is this a defined part of XQuery or is this
>> MarkLogic-specific?
>>
>> Thanks,
>>
>> Alex
>>      
>    
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to