Right: Both elements have the same value for uri, even though they have 
different element text nodes, so they are both referring to the same topic. I 
would like to be able to do something like an element-values query that returns 
unique element text values based on the uri attribute rather than the element 
text itself. I know that sounds a little counterintuitive, but the goal is a 
rationalized list of terms.

Perhaps a better example would be people:

<para>A person name <person-ref uri="org.lds.people/john-doe">John 
Doe</person-ref> is the same as a person named <person-ref 
uri="org.lds.people/john-doe">Doe, John</person-ref>.</para>

In this example, we're really talking about just one person, John Doe, so I 
would like to see an element value list that contains only one element--based 
on the uri attribute, not the element text.

Thinking about it more, though, I guess I could get the effect I want by doing 
a join of the results of an element-attribute-values index with a list of 
canonical terms. Don't know how well that would perform, though.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danny Sokolsky
Sent: Monday, August 11, 2008 7:17 PM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] Rationalized element range queries

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

----------------------------------------------------------------------
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