joewiz
8/17/2016 - 5:02 PM

Tests for the issue reported at http://stackoverflow.com/questions/38980559/xquery-test-for-two-specific-children-with-and/38980992?noredire

xquery version "3.0";

declare namespace tei = "http://www.tei-c.org/ns/1.0";

let $in-memory-node := 
    <persName xmlns="http://www.tei-c.org/ns/1.0" xml:id="person">
        <forename/>
        <surname/>
    </persName>
(:let $on-disk-node := doc('/db/test2.xml')/tei:persName:)
let $on-disk-node := doc('/db/test2.xml')/id('person')
for $node in ($in-memory-node, $on-disk-node)
return
    $node/tei:forename and $node/tei:surname
<persName xmlns="http://www.tei-c.org/ns/1.0" xml:id="person">
    <forename/>
    <surname/>
</persName>
xquery version "3.0";

declare namespace foo = "foo";

let $in-memory-node := 
    <root xmlns="foo">
        <x/>
        <y/>
    </root>
let $on-disk-node := doc('/db/test.xml')/foo:root
for $node in ($in-memory-node, $on-disk-node)
return
    $node/foo:x and $node/foo:y
<root xmlns="foo">
    <x/>
    <y/>
</root>