string treated as sequence
Posted: Fri Jul 01, 2011 6:28 pm
I've got this function which is giving me some strange errors during debug.
Either the parameters and return value are raw string, so why is treating them as sequence?xquery.xq
Severity: fatal
Description: A sequence of more than one item is not allowed as the first argument of string-length() ("Abonnement...", "film...", ...)
Start location: 315:0
URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004
Code: Select all
declare function local:normalizeSourceHelper(
$sourceString as xs:string,
$compareString as xs:string)
as xs:string* {
let $result :=
let $arraySource := tokenize($sourceString, ";")
let $arraycompare := tokenize($compareString, ";")
for $source in $arraySource
where $source != ""
return
if(count(
for $compare in $arraycompare
where $compare = $source return (1))=0 )
then concat(data($source), ";")
else
""
return
if(string-length($result)>0) then common:removeLastSemiColumnChar($result)
else $result
};