Description
The functx:value-union function returns the union of the values in two sequences in an implementation-defined order. It removes duplicates, even among the values that appear only in one of the sequences. This function is useful because the built-in union (or "|") operator only works on nodes, not atomic values.
Arguments and Return Type| Name | Type | Description |
$arg1 |
xs:anyAtomicType* |
the first sequence |
$arg2 |
xs:anyAtomicType* |
the second sequence |
| return value |
xs:anyAtomicType* |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:value-union
( $arg1 as xs:anyAtomicType* ,
$arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* {
distinct-values(($arg1, $arg2))
} ; | | XQuery Syntax for July 2004 - November 2005 (CR): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:value-union
( $arg1 as xdt:anyAtomicType* ,
$arg2 as xdt:anyAtomicType* ) as xdt:anyAtomicType* {
distinct-values(($arg1, $arg2))
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function value-union
( $arg1 as xdt:anyAtomicType* ,
$arg2 as xdt:anyAtomicType* ) as xdt:anyAtomicType* {
fn:distinct-values(($arg1, $arg2))
} |
Examples| XQuery Example | Results |
|---|
functx:value-union((1,2),(3,4))
|
(1, 2, 3, 4)
|
functx:value-union((1,2,3),(2,3,4))
|
(1, 2, 3, 4)
|
functx:value-union((1,2,2,3),(3,4))
|
(1, 2, 3, 4)
|
functx:value-union((1,2,2,3),())
|
(1, 2, 3)
|
See AlsoHistory |
|