Hi,
I found that with the following code the trace shows that, for the two functions (FN) created, both have gotten "ul" inlined. I expected the first to get "ul" and the second "li" and that is also what xpath-matches() receives (X).
declare function local:select($selectors as item()*) as function(node()*) as node()* { let $fns := for $selector in $selectors return if ($selector instance of xs:string) then trace(local:xpath-matches(trace($selector,'X: ')),'FN: ') else $selector return function($nodes) { fold-left($fns, $nodes, function($nodes, $fn) { $fn($nodes) } ) } };
declare function local:xpath-matches($selector as xs:string) { function($node as node()*) as node()* { xquery:eval($selector, map { '': $node }) } };
local:select(('ul','li'))(<ul><li>item</li></ul>)
--Marc