W3C home > Mailing lists > Public > public-qt-comments@w3.org > July 2003

Re: MS-FO-LC1-036: string-join example is wrong

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 1 Jul 2003 10:21:02 +0100
Message-ID: <81480663517.20030701102102@jenitennison.com>
To: "Michael Rys" <mrys@microsoft.com>
CC: public-qt-comments@w3.org

Michael Rys wrote:
> Last example fn:string-join is wrong: ancestor-or-self::* is a
> reverse axis so result would be section/chap/doc. Either fix the
> result or add a /. at the end of the path expression.

The example is correct in terms of the ordering of the result. The
results of a path expression are always returned in document order, so
the path "ancestor-or-self::*" returns the <doc> element, followed by
the <chapter> element, followed by the <section> element.

The example is wrong, however, because it uses the expression
"name(.)" when it should use "name($n)". The current example would
return "section/section/section" since "name(.)" always returns
"section". The corrected example is:

  fn:string-join(for $n in ancestor-or-self::* return name($n), '/')

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Tuesday, 1 July 2003 05:21:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:48 UTC