From 6471025219578501000553c5d5099e21da43e635 Mon Sep 17 00:00:00 2001 From: Michael Kay Date: Wed, 13 Nov 2024 00:33:45 +0000 Subject: [PATCH] Change spec of fn:siblings to include self in all cases --- .../src/function-catalog.xml | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml index ac4500996..568751fbb 100644 --- a/specifications/xpath-functions-40/src/function-catalog.xml +++ b/specifications/xpath-functions-40/src/function-catalog.xml @@ -13897,20 +13897,25 @@ return empty($break) focus-independent -

Returns the siblings of the supplied node.

+

Returns the supplied node together with its siblings, in document order.

If the $node argument is omitted, it defaults to the context value (.).

-

If the value of $node is an empty sequence, or if it is an attribute or namespace node, - or if $node has no parent, the function returns an empty sequence.

-

The function returns the siblings of $node, that is, the sequence of nodes having the - same parent as $node, in document order. The result includes $node itself.

+ +

If the value of $node is an empty sequence, the function returns an empty sequence.

+ +

If $node is a child of some parent node P, the function returns all the + children of P (including $node), in document order.

+ +

Otherwise (specifically, if $node is parentless, or if it is an attribute or namespace node), + the function returns $node.

+
-if ($node[self::(attribute() | namespace-node())]) -then () -else $node/parent::node()/child::node() +if ($node intersect $node/parent::node()/child::node()) +then $node/parent::node()/child::node() +else $node

The following errors may be raised when $node is omitted:

@@ -13928,9 +13933,17 @@ else $node/parent::node()/child::node()
+ +

The result of siblings($n) (except in error cases) is the same as + the result of $n/(preceding-sibling::node() | following-sibling-or-self::node()). + It is also the same as $n/(preceding-sibling-or-self::node() | following-sibling::node())

+

As with names such as parent and child, the word sibling + used here as a technical term is not a precise match to its use in describing human family relationships, + but is chosen for convenience.

+
- Atext]]> + Atext]]> siblings($e//a) ! string() @@ -13941,13 +13954,13 @@ else $node/parent::node()/child::node() "A", "text", "3.14159" - siblings($e//@x) - () + siblings($e//@x) ! string() + "X" -

New in 4.0

+

New in 4.0