[XQuery] use of distinct-values in chapter 3.8.4

In the XQuery Working Draft (12 November 2003) in chapter 3.8.4 (Example)
the function distinct-values is used to eliminate duplicate authors.

However the line reads

  for $a in fn:distinct-values($books)//author

Since the function returns atomic type values this seems to be broken
(//author on atomic values). So I think the right parenthesis has to be
after author.

Beside this the following lines contains a second error

  <name>
    { $a/text() }
  </name>

Comparing other examples I have the understanding that distinct-values
not only convert nodes to atomic type values (with dm:typed-value ?) for
comparison but to return these atomic values as well. Therefor the
'/text()' has to be removed since $a doesn't represent the author element
node but the text content.

Comment:
I find the last mentioned fact that we will get atomic type values even if
we provide a node sequence is not quite obvious. So a short note or an
additional example in the 'Functions and Operators' document would be
helpful.


Regards
Timo

Received on Thursday, 5 February 2004 11:41:29 UTC