Unsuitable types for + operation
Added by Anonymous about 17 years ago
Legacy ID: #4506033 Legacy Poster: Joseph Thomas-Kerr (jak09)
Hi, I'm trying to figure out why SaxonJ 8.9 is telling me "Unsuitable types for + operation at value="$avc:sps[$avc:pps[$avc:ppsID + 1]/avc:seq_parameter_set_id + 1]" at context node avc:pic_parameter_set_id." I had just changed from using unqualified variables to using qualified ones. The expression compiles and runs fine with unqualified variables, but now it fails at run time with the above error. This seems very odd to me. Is it a bug? Or am I missing something? Delving under the bonnet a little I discovered that the left-hand operand of the + operation is SingletonAtomizer whose operand is a DocumentSorter when unqualified variable references are used, but a VariableReference when qualified variables are used (ie the expression above). I don't know what a DocumentSorter is, but it seems to me that VariableReference isn't right, because the operand should be an AxisExpression whose start is the VariableReference. Clear as mud? Regards, Joe.
Replies (1)
RE: Unsuitable types for + operation - Added by Anonymous about 17 years ago
Legacy ID: #4506077 Legacy Poster: Michael Kay (mhkay)
Can't tell from this evidence: could you try and supply a repro please? (That is, a set of files that I can run to reproduce the problem). It could be a bug (anything is possible). I would be very surprised if it has anything to do with the use of namespaced variable names (but bugs are sometimes very surprising). The most likely situation is that the lh operand for some reason isn't being converted from untypedAtomic to a number. There's going to be quite a bit of optimizer rewriting of this expression because you're doing a computation inside [] that can be done outside the [], and it would seem on the surface that the conversion to a number has somehow been left out in the process. (If you want a quick fix, do the conversion by hand with a call to number().) Is it XQuery or XSLT? Try changing the "+" to "--". I know that sounds a weird suggestion, but the code for "-" is almost identical to that for "+", except that it puts more information into this particular error message! Michael Kay http://www.saxonica.com/
Please register to reply