1
declare variable $externalVariableAsInt as xs:integer := xs:integer($externalVariable);
2
$externalVariable, $externalVariableAsInt + 3, <e>{$externalVariable}</e>, $externalVariable instance of xs:string