With XSH, it is possible to browse document trees as if they were a local filesystem, except that XPath expressions are used instead of ordinary UNIX paths.
Current position in the document tree is called the current node. Current node's XPath may be queried with pwd command. In the interactive shell, current node is also displayed in the command line prompt. Remember, that beside cd command, current node (and document) is silently changed by all variant of open command, create command and temporarily also by the node-list variant of the foreach statement.
Documents are specified in a similar way as harddrives on DOS/Windows(TM) systems (except that their names are not limitted to one letter in XSH), i.e. by a prefix of the form doc: where doc is the id associated with the document.
To mimic the filesystem navigation as closely as possible, XSH contains several commands named by analogy of UNIX filesystem commands, such as cd, ls and pwd.
xsh scratch:/> open docA="testA.xml" xsh docB:/> open docB="testB.xml" xsh> pwd docB:/ xsh docB:/> cd docA:/article/chapter[title='Conclusion'] xsh docA:/article/chapter[5]> pwd docA:/article/chapter[5] xsh docA:/article/chapter[5]> cd previous-sibling::chapter xsh docA:/article/chapter[4]> cd .. xsh docA:/article> select docB xsh docB:/>
change current context node
mark elements to be folded by list command
show a given node location (as a cannonical XPath)
list a given part of a document as XML
show current context node location (as a cannonical XPath)
define XPath extension function (EXPERIMENTAL)
register namespace prefix to use XPath expressions
register XHTML namespace prefix to use XPath expressions
register XSH namespace prefix to use XPath expressions
make a given document the current one
unfold elements folded with fold command
undefine extension function (EXPERIMENTAL)
unregister namespace prefix
XPath expression