Document more clearly on XML namespaces inside xpath function
authorBruce Momjian
Sat, 3 Jul 2010 17:21:48 +0000 (17:21 +0000)
committerBruce Momjian
Sat, 3 Jul 2010 17:21:48 +0000 (17:21 +0000)
Nikolay Samokhvalov

doc/src/sgml/func.sgml

index fd28615ae0ecc2c8559fee285fd747f18ef07b37..659da49a8498739108996799572b4cc3c327f72e 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
  
   Functions and Operators
@@ -8610,8 +8610,11 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
     mappings.  This array should be a two-dimensional array with the
     length of the second axis being equal to 2 (i.e., it should be an
     array of arrays, each of which consists of exactly 2 elements).
-    The first element of each array entry is the namespace name, the
-    second the namespace URI.
+    The first element of each array entry is the namespace name (alias), the
+    second the namespace URI. It is not required that aliases provided in
+    this array are the same that those being used in the XML document itself (in
+    other words, both in the XML document and in the xpath
+    function context, aliases are local).
    
 
    
@@ -8624,6 +8627,19 @@ SELECT xpath('/my:a/text()', 'test',
 --------
  {test}
 (1 row)
+]]>
+   
+
+   
+    How to deal with default (anonymous) namespaces:
+
+SELECT xpath('//mydefns:b/text()', 'test',
+             ARRAY[ARRAY['mydefns', 'http://example.com']]);
+
+ xpath
+--------
+ {test}
+(1 row)
 ]]>