Hi Adam,

Do you mean you only want to highlight matches when the occur in the context of 
a <tei:placeName ref="PL-CA-ON-TO">  element?  If so, I think you might be able 
to do something like find the text to highlight using cts:highlight and then 
use the $cts:node variable start at the text node where the match is, then 
navigate up to the element node parent and test for the existence of the ref 
attribute before performing your highlight replacement.

Depending on what you are doing, you might find cts:walk useful for this too 
(cts:walk does not return a copy of the node like cts:highlight does, but other 
than that it is similar).

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Adam Patterson
Sent: Thursday, May 06, 2010 9:51 AM
To: [email protected]
Subject: [MarkLogic Dev General] cts:highlight question

Hi,

I see from the documentation that cts:highlight will not work with 
cts:element-attribute-*-query items. Unfortunatley for me, this is exactly what 
I need. So, I am wondering, if I have XML as follows:

<p>By <rs ref="#RG-breithauptFam" type="relationGroup">our</rs>
                                    request <persName 
ref="#PE-DocBowlby1"><choice>
                                            <reg>Dr Bowlby</reg>
                                            <orig>D<hi rend="superscript"><hi 
rend="underlined"
                                                  >r</hi></hi> Bowlby</orig>
                                        </choice></persName><lb/>summoned 
<persName
                                        ref="#PE-DocCovernton1"><choice>
                                            <reg>Dr Covernton</reg>
                                            <orig>D<hi rend="superscript"><hi 
rend="underlined"
                                                  >r</hi></hi> Covernton</orig>
                                        </choice></persName> of<lb/><hi 
rend="underlined"><placeName
                                            
ref="#PL-CA-ON-TO">Toronto</placeName></hi><note n="1"
                                        type="transcription">Possibly rendered 
by other party (i.e.
                                        in pencil).</note> for consultation 
to-day.<lb/><hi
                                        rend="underlined"><persName 
ref="#PE-DocCovernton1">Dr
                                            C.</persName></hi><note 
type="transcription" n="2"
                                        >Possibly underlined by other party 
(i.e. in pencil).</note>
                                    was here with <hi 
rend="underlined"><persName
                                            ref="#PE-DocBowlby1">Mr 
Bowlby</persName></hi><note
                                        n="3" type="transcription">Possibly 
underlined by other
                                        party (i.e. in pencil).</note><lb/>this 
afternoon &amp;
                                    undertook a<lb/>minute examination of 
<persName
                                        
ref="#PE-PhilipLouisB1">Pa</persName>&apos;s<lb/>sickness.
                                    The trouble is now<lb/>chiefly with the <hi 
rend="underlined"
                                        >liver</hi><note type="transcription" 
n="4">Possibly
                                        underlined by other party (i.e. in 
pencil).</note>
                                    which<lb/>is <hi 
rend="underlined">enlarged</hi><note n="5"
                                        type="transcription">Possibly rendered 
by other party (i.e.
                                        in pencil).</note> &amp; is threatened 
by<lb/>an abscess.
                                    The kidneys per-<lb/>-form their duty 
freely the last<lb/>few
                                    days. Dropsy is also<lb/>subsiding 
somewhat.</p>
                                <p>

And I want to highlight all occurrences of <tei:placeName 
ref="PL-CA-ON-TO">...</tei:placeName> using cts:highlight. In the above example 
there is exactly one match, but there could be any number in practice. Does 
anyone have advice for me on this issue?

Thanks,

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

Reply via email to