87. selectNode

Parameter syntax:

'parent' | 'child' | 'anyChild' |
'firstChild' | 'lastChild' | 'children' |
'previousSibling' | 'nextSibling' | 
'firstSibling' | 'lastSibling' | 
'ancestor' | 'ancestorOrSelf' | 'self' |
'descendant' | 'descendantOrSelf' |
'preceding' | 'precedingOrSelf' |
'following' | 'followingOrSelf' |
'extendToPreviousSibling' | 'extendToNextSibling'
[ 'OrNone' | 'OrNode' | 'OrElement' ]? 
[ implicit_selection ]? 
S [ element_name | '#text' | '#comment' | '#processing-instruction' ]*

A number of keystrokes are bound to this command. This command is also needed to write non-trivial macro-commands.

parent

Selects parent of selected node.

child

Selects previously selected child of selected node.

If no child of selected node was previously selected, selects first child node of selected node.

Note

Option child has not been designed to be used in macro-commands. This option has been designed mainly to allow binding Ctrl+DOWN to command selectNode child. If you need to select the first child of selected element having a given element name or node type, please use option anyChild instead.

anyChild

Selects first found child node of selected node having a given element name or node type. How to specify the element name or node type searched for is explained in Section 87.1, “List of element names or node types”.

firstChild

Selects first child node of selected node.

lastChild

Selects last child node of selected node.

children

Selects all the child nodes of selected node.

previousSibling

Selects preceding sibling of selected node.

nextSibling

Selects following sibling of selected node.

firstSibling

Selects first preceding sibling of selected node.

lastSibling

Selects last following sibling of selected node.

self

Selects selected node if selected node is an element, or parent element of selected node if selected node is a text. This option is mainly useful to test the name of implicitly or explicitly selected element.

ancestorOrSelf

Selects ancestor of selected node, starting at selected node. Searched ancestor is specified using a list of names. See below.

More precisely, lookup starts from selected node, if selected node is an element, or from parent element of selected node if selected node is a text, comment or processing-instruction node.

ancestor

Selects ancestor of selected node, starting at parent of selected node. Searched ancestor is specified using a list of names. See below.

More precisely, lookup starts from parent of selected node, if selected node is an element, or from grand-parent element of selected node if selected node is a text, comment or processing-instruction node.

Note that selectNode ancestor one_or_more_element_names selects all the ancestors one after the other until it reaches the found ancestor. This is equivalent to interactively typing Ctrl+Up until the desired ancestor is selected. The idea behind that is to be able to use selectNode ancestor one_or_more_element_names followed by selectNode child or selectNode descendant one_or_more_element_names in the same macro-command.

descendant

Selects previously selected descendant of selected node. Searched descendant is specified using a list of element names or node types. See below.

If no descendants of selected node were previously selected, searches a descendant node along the first child axis.

descendantOrSelf

Selects previously selected descendant of selected node. Searched descendant is specified using a list of element names or node types. See below.

If no descendants of selected node were previously selected, searches a descendant node along the first child axis.

Selected node itself can be explicitly selected if it corresponds to searched node.

precedingOrSelf

Selects preceding sibling of selected node, starting at selected node. Searched sibling is specified using a list of names. See below.

preceding

Selects preceding sibling of selected node, starting at sibling of selected node. Searched sibling is specified using a list of names. See below.

followingOrSelf

Selects following sibling of selected node, starting at selected node. Searched sibling is specified using a list of names. See below.

following

Selects following sibling of selected node, starting at sibling of selected node. Searched sibling is specified using a list of names. See below.

extendToPreviousSibling

Extends node selection to following sibling of last selected node.

extendToNextSibling

Extends node selection to preceding sibling of last selected node.

Examples:

selectNode childOrNone
selectNode parentOrNode
selectNode children
selectNode nextSibling[implicitElement]
selectNode self section
selectNode ancestorOrSelf[implicitElement] section sect5 sect4 sect3 sect2 sect1
selectNode descendant {http://www.xmlmind.com/xmleditor/schema/configuration}template \
  {http://www.xmlmind.com/xmleditor/schema/configuration}css
selectNode extendToPreviousSibling
selectNode extendToNextSiblingOrElement