Arbortext Command Language > Functions by Alphabetical Listing > oid_xpath_matches
  
oid_xpath_matches
oid_xpath_matches (oid, expr[, nsOid])
This function tests whether an OID matches an XPath pattern. expr follows the same form as XSLT pattern matching expressions (xsl:template match attribute). Returns 1 if oid matches expr and 0 if not. To handle errors, call this function from within a catch.
This function has the following parameters:
oid — The object to test.
expr — A valid XPath pattern.
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.
Examples:
oid_xpath_matches(oid_caret(), "para")
Returns 1 for any para element.
oid_xpath_matches(oid, "chapter/para[1]")
Returns 1 for the first para in any chapter.