string treated as sequence
Having trouble installing Oxygen? Got a bug to report? Post it all here.
			- 
				sandrocchio_0.1
 - Posts: 14
 - Joined: Tue Nov 23, 2010 4:04 pm
 
string treated as sequence
Post by sandrocchio_0.1 »
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
};
- 
				adrian
 - Posts: 2894
 - Joined: Tue May 17, 2005 4:01 pm
 
Re: string treated as sequence
Hello,
The error complains about the argument of string-length() being a sequence. The argument is $result. Now look at the value assigned to $result:
It's the result of a for which creates a sequence. Ir may be a sequence of strings, but it's still a sequence, hence the problem.
Regards,
Adrian
			
			
									
									The error complains about the argument of string-length() being a sequence. The argument is $result. Now look at the value assigned to $result:
Code: Select all
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
                 ""Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
						<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
- 
				sandrocchio_0.1
 - Posts: 14
 - Joined: Tue Nov 23, 2010 4:04 pm
 
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
 - ↳ Feature Request
 - ↳ Common Problems
 - ↳ DITA (Editing and Publishing DITA Content)
 - ↳ Artificial Intelligence (AI Positron Assistant add-on)
 - ↳ SDK-API, Frameworks - Document Types
 - ↳ DocBook
 - ↳ TEI
 - ↳ XHTML
 - ↳ Other Issues
 - Oxygen XML Web Author
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Content Fusion
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen JSON Editor
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen PDF Chemistry
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen Feedback
 - ↳ Feature Request
 - ↳ Common Problems
 - Oxygen XML WebHelp
 - ↳ Feature Request
 - ↳ Common Problems
 - XML
 - ↳ General XML Questions
 - ↳ XSLT and FOP
 - ↳ XML Schemas
 - ↳ XQuery
 - NVDL
 - ↳ General NVDL Issues
 - ↳ oNVDL Related Issues
 - XML Services Market
 - ↳ Offer a Service