Hi Stewart,

I am not positive I understand your question, but I will give it a try
anyway....

If you use plain XPath, you can use a predicate to constrain on an
attribute and then return the element text nodes.  For example:

let $x := <para>The topics <topic-ref
uri="org.lds.topics/gratitude">gratitude</topic-ref> and <topic-ref
uri="org.lds.topics/gratitude">thankfulness</topic-ref> are
similar.</para>
return
$x/topic-ref[./@uri eq "org.lds.topics/gratitude"]/text()

returns:

gratitude
thankfulness

This is part of where I don't understand the question, because you say
it should only be "gratitude".   What do you mean by that, as the uri
attribute has the same value for both topic-ref elements?

-Danny


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stewart
Shelline
Sent: Monday, August 11, 2008 3:10 PM
To: [email protected]
Subject: [MarkLogic Dev General] Rationalized element range queries

Is there a way to constrain the list of element values based on an
attribute of the element? For example, given the XML below:

<para>The topics <topic-ref
uri="org.lds.topics/gratitude">gratitude</topic-ref> and <topic-ref
uri="org.lds.topics/gratitude">thankfulness</topic-ref> are
similar.</para>

I would like to have the index based on the value of the uri attribute
but return the text node from the element. In the case above, that would
mean just one item, "gratitude." It appears that you can create an index
on an element or an attribute, but not a combination.
________________________________________
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to