W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2005

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

From: <bugzilla@wiggum.w3.org>
Date: Tue, 19 Apr 2005 08:34:53 +0000
To: public-qt-comments@w3.org
Cc:
Message-Id: <E1DNoC5-0006fk-9t@wiggum.w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:37 GMT