From: jon
Date: November 29 2007 1:38pm
Subject: svn commit - mysqldoc@docsrva: r8977 - in trunk: refman-5.1 refman-6.0
List-Archive: http://lists.mysql.com/commits/38829
Message-Id: <200711291338.lATDc8iZ021505@docsrva.mysql.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jstephens
Date: 2007-11-29 14:38:08 +0100 (Thu, 29 Nov 2007)
New Revision: 8977
Log:
Updated discussion of 5.1/6.0 XPath support (Thanks, Bar!):
| = logical UNION, not OR
logical or can be used inside predicates
relative paths are supported, including within predicates
Modified:
trunk/refman-5.1/functions-core.xml
trunk/refman-6.0/functions-core.xml
Modified: trunk/refman-5.1/functions-core.xml
===================================================================
--- trunk/refman-5.1/functions-core.xml 2007-11-29 13:07:30 UTC (rev 8976)
+++ trunk/refman-5.1/functions-core.xml 2007-11-29 13:38:08 UTC (rev 8977)
Changed blocks: 3, Lines Added: 59, Lines Deleted: 11; 3875 bytes
@@ -13559,11 +13559,11 @@
- Multiple locators may be matched using the
- | (logical OR) operator.
- For example, the expression //b|//c matches
- all b and
- c elements in the XML target.
+ 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.
@@ -13591,14 +13591,24 @@
- To find elements for which the same attribute matches one of
- several values, you must use multiple locators joined by the
+ 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"].
+ //b[@c="23"]|//b[@c="17"]. You can also use
+ the logical or operator for this purpose:
+ //b[@c="23" or @c="17"].
+
+
+
+ The difference between or and
+ | is that or joins
+ conditions, while | joins result sets.
+
+
@@ -13645,10 +13655,48 @@
- Relative locator expressions are not supported. XPath
- expressions must begin with / or
- //.
+ 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:
+
+
+mysql> SELECT ExtractValue(
+ -> '<a>
+ -> <b c="1"><d>X</d></b>
+ -> <b c="2"><d>X</d></b>
+ -> </a>',
+ -> 'a/b/d[../@c="1"]')
+ -> AS result;
++--------+
+| result |
++--------+
+| X |
++--------+
+1 row in set (0.00 sec)
+
+
Modified: trunk/refman-6.0/functions-core.xml
===================================================================
--- trunk/refman-6.0/functions-core.xml 2007-11-29 13:07:30 UTC (rev 8976)
+++ trunk/refman-6.0/functions-core.xml 2007-11-29 13:38:08 UTC (rev 8977)
Changed blocks: 3, Lines Added: 59, Lines Deleted: 11; 3875 bytes
@@ -13500,11 +13500,11 @@
- Multiple locators may be matched using the
- | (logical OR) operator.
- For example, the expression //b|//c matches
- all b and
- c elements in the XML target.
+ 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.
@@ -13532,14 +13532,24 @@
- To find elements for which the same attribute matches one of
- several values, you must use multiple locators joined by the
+ 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"].
+ //b[@c="23"]|//b[@c="17"]. You can also use
+ the logical or operator for this purpose:
+ //b[@c="23" or @c="17"].
+
+
+
+ The difference between or and
+ | is that or joins
+ conditions, while | joins result sets.
+
+
@@ -13583,10 +13593,48 @@
- Relative locator expressions are not supported. XPath
- expressions must begin with / or
- //.
+ 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:
+
+
+mysql> SELECT ExtractValue(
+ -> '<a>
+ -> <b c="1"><d>X</d></b>
+ -> <b c="2"><d>X</d></b>
+ -> </a>',
+ -> 'a/b/d[../@c="1"]')
+ -> AS result;
++--------+
+| result |
++--------+
+| X |
++--------+
+1 row in set (0.00 sec)
+
+