fold [--depth|:d expression] [expression]


This feature is still EXPERIMENTAL and may change in the future! Fold command may be used to mark elements with a xsh:fold attribute from the namespace. When listing the DOM tree using ls --fold xpath, elements marked in this way are folded to a given depth (default is 0 = fold immediately).

The option --depth (:d) may be used to specify the depth at which subtrees of given elements are to be folded.

If called without arguments, the command applies to the current element, otherwise the expression is evaluated to the node-list and folding is applied to all elements within this node-list.

xsh> fold --depth 1 //chapter
xsh> ls --fold  //chapter[1]
<chapter id="intro" xsh:fold="1">

See Also

unfold, ls