This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1256 - [XPath] Error in example in 3.7 (distinct-values())
Summary: [XPath] Error in example in 3.7 (distinct-values())
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 2.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 minor
Target Milestone: ---
Assignee: Don Chamberlin
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-19 08:34 UTC by Michael Kay
Modified: 2005-05-05 00:12 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2005-04-19 08:34:53 UTC
The following example

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

does not produce the output illustrated. It returns a heterogenous sequence
containing strings (the result of atomizing an author element) and title
elements. The result of distinct-values() is an atomic sequence. The example
could be corrected to:

for $a in fn:distinct-values(/bib/book/author)
return (/bib/book/author[. = $a], /bib/book[author = $a]/title)

But I think it would be best to replace this example with a more realistic one:
in practice this problem would be tackled using xsl:for-each-group.

(Problem with this example was pointed out by Bob du Charme on the Saxon list.)
Comment 1 Don Chamberlin 2005-05-05 00:11:58 UTC
Michael,
Thanks for your comment. I have corrected the example in Section 3.7 as you 
suggested. I consider this to be an editorial correction. If you wish to 
suggest a specific alternative example, please send it to me.
Regards,
--Don Chamberlin