This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
From my point of view, by (hopefully) cautiously reading the spec, the last example given for string-join is just wrong: fn:string-join(for $n in ancestor-or-self::* return name($n), '/') shall return "/doc/chap/section" and not "doc/chap/section" Why? I cannot see any reason why fn:string-join(('', 'a', 'b'), '+') shall return "a+b". It shall be "+a+b"! If this is not a bug in the spec, it would be nice to put an example into the spec and clarify the reason. P.S.: the leading and trailing blank for the first two examples may confuse as well.
I believe the example is correct. I can't see why you think it is wrong. Perhaps you read ancestor-or-self::* (which selects all element ancestors) as ancestor-or-self::node() (which also selects the document node). Michael Kay (personal response)
Michael, you are correct! Its my fault, as in my special case (implementation) we have no document node as the root node is just as normal as the others. But nevertheless, it might be good idea to insert another example at fn:string-join. Maybe fn:string-join(('', 'a', 'b'), '+') return "+a+b" thank you for your quick reaction
Whether or not your tree has a document node, ancestor::*/name() is going to produce a sequence of non-empty names. It's only if your tree DOES have a document node, and your XPath expression selects that node, that the sequence of names will start with the string "", and the result of string-join will then start with the delimiter "/". Michael Kay