xQuery variable holding wildcard * (any)

mn_h4ck3r

New Member
I would like to parametrize a XPATH filter for a function, but would like to have the chance of indicating I want all the results. Clear example\[code\]declare function search-by-author($author as xs:string*) as element()*{ /Data/Books[@autor=$author]};search-by-author(()) -> If null no results even if some books did not have @autor attrsearch-by-author('') -> If empty, only shows those books with @author=''search-by-author(('a','b')) -> Returns books by authors 'a' or 'b'search-by-author(*) -> THIS MY CURRENT PROBLEM. \[/code\]How could I emulate this? Is there any special param or syntax to pass * as a variable, so I can do\[code\] $var = * --> /Data/Books[@autor=$var] \[/code\]or\[code\] $var = EMPTY --> /Data/Books[@autor=$var] --> /Data/Books[@autor]\[/code\]Thank you!
 
Back
Top