[xquery-talk] using OR in xquery expression

Titash Neogi titash_neogi at symantec.com
Thu May 18 04:28:21 PDT 2006


Dear XQuery Experts,


Please consider the following XML extracts

__EXTRACT A__

<sectioninfo>
        <keywordset>
            <keyword role="infotype">reference</keyword>
            <keyword role="subject">Explanation</keyword>
            <keyword role="subrel">scan-status</keyword>
          
        </keywordset>
    </sectioninfo>


__EXTRACT B__

<sectioninfo>
        <keywordset>
            <keyword role="infotype">reference</keyword>
            <keyword role="subject">Explanation</keyword>
            <keyword role="objrel">scan-status</keyword>
          
        </keywordset>
    </sectioninfo>


Now please consider the following query below

	for $r in //section where
$r/sectioninfo/keywordset/keyword[@role="subject"]= "Explanation" return


(for $p in //section where 
($r/sectioninfo/keywordset/keyword[@role="objrel"]="scan-status") 
or 
($r/sectioninfo/keywordset/keyword[@role="subrel"]="scan-status") return
$p)

Given this XQuery, the database returns only Extract B (where the objrel
value is "scan status") but does not return Extract A (where subrel
value is "scan status")

I am unable to understand why this is happening since I am using OR so
that either of the two expressions should return a result.

Please guide me on this.
FYI, I am using the exist XML DB.

Thanks and Regards
Titash Neogi




More information about the talk mailing list