selectSingle. XPath search for single node

^node.selectSingle[XPath-query]

This method returns node found in the scope of specified node and satisfying specified
XPath-query. If no node was found, void is returned. If more than one node is returned exception is thrown.

Before using prefixes of name spaces in the
query one must define them, see $xdoc.search-namespaces.

Example
$d[^xdoc::create{<?xml version="1.0" encoding="windows-1251" ?>
<t attr="
hello" n="123"/>}]
result=1 element "t"
$element[^d.selectSingle[t]]
# result=2 (number of attributes <t>)
Number of attributes
^element.attributes._count[]<br />

Detailed specification of XPath is available at: http://www.w3.org/TR/xpath



Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 21.09.2007