Sorry for what is probably a very basic question; I've read through a number of 
XQuery tutorials but haven't been able to come up with something that yields 
the expected results. I have a MarkLogic database, which contains a few 
thousand XML documents. I'm trying to return the value of the ML UID (captured 
in the XML document as <system-pub-id>) for a known document identifier 
<article-title id="value">.

I've tried several variants of the following, but each returns the full set of 
system-pub-ids rather than the one matching the specified id value.

I've tried running through oXygen as well as the MarkLogic console; I get the 
same results (which I suppose is a good thing). I'm pretty certain that I'm 
missing something obvious, and appreciate any pointers.

I started with this:
xquery version "1.0-ml";
for $mlid in /samhsa-doc//system-pub-id
where /samhsa-doc//article-title[@id="AVD210_art1"]
return $mlid

but when I got the full list back (some 14,000 items - many of which don't have 
an article-title) I thought I'd try starting at the root ...

XQuery:
xquery version "1.0-ml";
for $mlid in /samhsa-doc
where /samhsa-doc//article-title[@id='AVD210_art1']
return $mlid//system-pub-id


XML:
<?xml version="1.0" encoding="UTF-8"?>
<samhsa-doc>
        <doc-meta>
                <status>Archived</status>
                <system-pub-id>100001</system-pub-id>
                <display-mode>Internal and External</display-mode>
        </doc-meta>
        <doc-content>
                <samhsapub>
                        <article>
                                <front>
                                        <article-meta>
                                                <title-group>
                                                        <article-title 
id="AVD210_art1"> ... </article-title>
                                                ...


Thank you in advance,

Mary
                                        

Mary McRae, PMPĀ | XML Strategist / Technical Project ManagerĀ | 
[email protected]



_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to