Arbortext Command Language > Functions by Alphabetical Listing > oid_xpath_nodeset
  
oid_xpath_nodeset
oid_xpath_nodeset (oid, arr, expr[, nsOid])
This function evaluates an XPath expression in the context of an OID and returns the result as an array of OIDs. This function can be used to identify a group of elements to be iterated through. It can also be used for navigation, for example, by passing one of the returned OIDs to goto_oid.
oid — The object to use as the context node.
arr — An unordered array of OIDs returned by expr.
expr — A valid XPath expression that evaluates to a node set containing only XPath nodes that have associated OIDs.
Do not use expressions that contain position() or last(). They do not work in this context. Use the preceding-sibling or following-sibling axes instead to achieve the desired results. For example:
count(preceding-sibling::*)=0 will test that the context node is the first child of its parent.
count(preceding-sibling::para)=1 will test that the context node is the second para child of its parent.
count(following-sibling::*)=0 is a viable alternative to position()=last()
nsOid (optional) — The node used for resolving namespace prefixes in the XPath expression.
The nsOid parameter is useful when you need to evaluate the same XPath expression against many XML documents. Those documents might use a different namespace prefix than the XPath expression. If you provide an OID where the namespace prefix is declared, its URI can be matched up with the document instances regardless of the namespace prefixes they used. For example, you might have a configuration file that uses XPath expressions to specify naming rules with namespace prefixes declared on its root element.
This function fills the array arr with the first OID of each XPath node returned by expr. The return value is the number of OIDs stored in arr. Duplicate OIDs may be returned if more than one XPath node resolves to the same OID. oid_null is returned for any XPath node that cannot be converted to an OID (for example, namespace nodes and attributes).
To handle errors, call this function from within a catch.
Related Topics
xpath_nodeset function
oid_xpath_boolean function
oid_xpath_integer function
oid_xpath_string function