Project

Profile

Help

need help using distinct-values()

Added by Anonymous over 18 years ago

Legacy ID: #3609690 Legacy Poster: Francis Upton (francisu)

Hi, I'm using Saxon 8.7. I get the message: net.sf.saxon.trans.StaticError: Required item type of first operand of '/' is node(); supplied value has item type xdt:anyAtomicType With the code below: for $out_Functions_ProductFunctions at $i53 in let $inVar := distinct-values($out_Functions/Loop-LIN/LIN[1]/LIN03) return $inVar return ... What am I doing wrong? Thanks


Replies (4)

Please register to reply

RE: need help using distinct-values() - Added by Anonymous over 18 years ago

Legacy ID: #3609727 Legacy Poster: Michael Kay (mhkay)

I suspect that the value of $out_Functions is an atomic value rather than a node (because that's what the error message is saying). You haven't shown us the variable declaration.

RE: need help using distinct-values() - Added by Anonymous over 18 years ago

Legacy ID: #3610000 Legacy Poster: Francis Upton (francisu)

Here is the value of $out_Functions, it's just from another FLOWR expr: for $out_Functions at $i0 in let $inVar := /Transaction-832 return $inVar return ... I'm still confused. Without the distinct-values() function things work fine.

RE: need help using distinct-values() - Added by Anonymous over 18 years ago

Legacy ID: #3610391 Legacy Poster: Michael Kay (mhkay)

I can't see what's going wrong from these fragments. I think you'll have to post a complete query and a sample document I can run it on. Incidentally, now the thread has started we'll get to the bottom of it: but so far, this seems to be a general XQuery coding problem and nothing specifically to do with Saxon.

RE: need help using distinct-values() - Added by Anonymous over 18 years ago

Legacy ID: #3610662 Legacy Poster: Francis Upton (francisu)

Yes, it's certainly a general XQuery problem. I did not understand that distinct-values() was not returning nodes, but rather the text values in this case. I worked it out. What I really want is the saxon:for-each-group function, which is in Saxon-SA, so I'm getting that. Thanks for your help. Francis

    (1-4/4)

    Please register to reply