Error in example of For Expression?

The XPath 2.0 WD http://www.w3.org/TR/2001/WD-xpath20-20011220 section 2.8
contains the example:

for $a in distinct-values(//author)
return ($a,
        for $b in //book[$b/author = $a]
        return $b/title)

The use of $b in //book[$b/author = $a] is an error acording to:

"A variable name may not be used before it is bound, nor may it be used in
the expression to which it is bound."

The example should use //book[author = $a]


Peter

Received on Tuesday, 5 February 2002 18:35:12 UTC