[Bug 1256] New: [XPath] Error in example in 3.7 (distinct-values())

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1256

           Summary: [XPath] Error in example in 3.7 (distinct-values())
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P2
         Component: XPath
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


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.)

Received on Tuesday, 19 April 2005 08:34:53 UTC