content_image/662487.jpg
+-------------------------------------------------+ | x | +-------------------------------------------------+ 1 row in set (0.00 sec) 

•The *  operator acts as a “wildcard”  that matches any element. For example, the expression /*/b matches the b  element in either of the XML fragments <a><b/></a>  or <c><b/></c> . However, the expression does not produce a match in the fragment <b><a/></b>  because b  must be a child of some other element. The wildcard may be used in any position: The expression /*/b/*  matches any child of a b  element that is itself not the root element. 

•You can match any of several locators using the |  ( UNION ) operator. For example, the expression // b|//c  matches all b  and c  elements in the XML target. 

•It is also possible to match an element based on the value of one or more of its attributes. This done using the syntax tag [@ attribute =" value "] . For example, the expression //b[@id="idB"] matches the second b  element in the fragment <a><b id="idA"/><c/><b id="idB"/></ a> . To match against any  element having attribute =" value " , use the XPath expression // *[ attribute =" value "] . 

To filter multiple attribute values, simply use multiple attribute-comparison clauses in succession. For example, the expression //b[@c="x"][@d="y"]  matches the element <b c="x" d="y"/>  occurring anywhere in a given XML fragment. 

To find elements for which the same attribute matches any of several values, you can use multiple locators joined by the |  operator. For example, to match all b  elements whose c  attributes have either of the values 23 or 17, use the expression //b[@c="23"]|//b[@c="17"] . You can also use the logical or  operator for this purpose: //b[@c="23" or @c="17"] . 

<img src='content_image/662487.jpg'>

## Note 

The difference between or  and |  is that or  joins conditions, while |  joins result sets. 

XPath Limitations.  The XPath syntax supported by these functions is currently subject to the following limitations: 

•Nodeset-to-nodeset comparison (such as ’/a/b[@c=@d]’ ) is not supported. 

•All of the standard XPath comparison operators are supported. (Bug #22823) 

•Relative locator expressions are resolved in the context of the root node. For example, consider the following query and result: 

mysql> SELECT ExtractValue( -> ’<a><b c="1">X</b><b c="2">Y</b></a>’, -> ’a/b’ -> ) AS result; +--------+ | result | +--------+ | X Y | +--------+ 1 row in set (0.03 sec) 

In this case, the locator a/b  resolves to /a/b . 

Relative locators are also supported within predicates. In the following example, d[../@c="1"]  is resolved as /a/b[@c="1"]/d : 

