My bad. I did not understand that indexes had to take non-null/empty values.
I fixed the problem by simply adding a check. let $dataset := doc("Customer.xml") return <results>{ for $element in $dataset/Customers/Customer let $name := $element/Name/text() let $typeId := $element/CustomerTypeId/text() let $type := if( $typeId != "" ) then index-scan("CustomerTypeIndex", $typeId, "EQ")/Name/text() else "" return(<r><c>{$name}</c><c>{$typeId}</c><c>{$type}</c></r>) }</results> -----Original Message----- From: Ivan Shcheklein [mailto:shchekl...@gmail.com] Sent: Wednesday, August 03, 2011 3:15 PM To: Malcolm Davis Cc: sedna-discussion@lists.sourceforge.net Subject: Re: [Sedna-discussion] index-scan binding fails with ERROR XPTY0004 Hi Malcolm, Am I missing something? Can an index-scan be used when trying to bind 2 documents together? Sure, it can. Please, send us full error message (if you don't use command line get error details from the event logs). Ivan Shcheklein, Sedna Team ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ Sedna-discussion mailing list Sedna-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sedna-discussion