for $profiles in collection('/db/Profiles/GenericResource')//Resource
let $scopes := string-join( $profiles/Scopes//Scope/text(), ';')
let $subtype := $profiles//Resource/Profile/SecondaryType/text()
<RES_SUBTYPE ISdefault =''/>
return
<RESOURCE/>