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

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