Example 2

Given Input Type XQuery Expression Expected Output Type
<!ELEMENT r (b*,c?,d)>
<!ELEMENT b EMPTY>
<!ELEMENT c EMPTY>
<!ELEMENT d EMPTY>
        <r>{for $y in child::* return <a>{$y}</a>}</r>  
        
<!ELEMENT r (a*)>
<!ELEMENT a (b|c|d)>
<!ELEMENT b EMPTY>
<!ELEMENT c EMPTY>
<!ELEMENT d EMPTY>

Explanation

Same example as the previous one except that the output type is modified so that "c" is allowed inside an "a" element.

Full Trace

The full trace generated by the implementation for the example above: