xquery version "1.0"; (: This function take a string as input and return it surrounded by stars '*' :) declare function addStars($str as xs:string) as xs:string { fn:concat("***", $str, "***") }; (: The script make use of its function :) fn:concat( addStars("some input string"), " ", addStars("some other string"))