1
- <!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.520 2010/06/29 22:29:13 momjian Exp $ -->
1
+ <!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.521 2010/07/03 17:21:48 momjian Exp $ -->
2
2
3
3
<chapter id="functions">
4
4
<title>Functions and Operators</title>
@@ -8610,8 +8610,11 @@ SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
8610
8610
mappings. This array should be a two-dimensional array with the
8611
8611
length of the second axis being equal to 2 (i.e., it should be an
8612
8612
array of arrays, each of which consists of exactly 2 elements).
8613
- The first element of each array entry is the namespace name, the
8614
- second the namespace URI.
8613
+ The first element of each array entry is the namespace name (alias), the
8614
+ second the namespace URI. It is not required that aliases provided in
8615
+ this array are the same that those being used in the XML document itself (in
8616
+ other words, both in the XML document and in the <function>xpath</function>
8617
+ function context, aliases are <emphasis>local</>).
8615
8618
</para>
8616
8619
8617
8620
<para>
@@ -8624,6 +8627,19 @@ SELECT xpath('/my:a/text()', '<my:a xmlns:my="http://example.com">test</my:a>',
8624
8627
--------
8625
8628
{test}
8626
8629
(1 row)
8630
+ ]]></screen>
8631
+ </para>
8632
+
8633
+ <para>
8634
+ How to deal with default (anonymous) namespaces:
8635
+ <screen><![CDATA[
8636
+ SELECT xpath('//mydefns:b/text()', '<a xmlns="http://example.com"><b>test</b></a>',
8637
+ ARRAY[ARRAY['mydefns', 'http://example.com']]);
8638
+
8639
+ xpath
8640
+ --------
8641
+ {test}
8642
+ (1 row)
8627
8643
]]></screen>
8628
8644
</para>
8629
8645
</sect2>
0 commit comments