home contribute faq download

FunctX XSLT Functions

functx:value-union

The union of two sequences of values

Google
Webxsltfunctions.com

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

NameTypeDescription
$arg1 xs:anyAtomicType* the first sequence
$arg2 xs:anyAtomicType* the second sequence
return value xs:anyAtomicType*

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:value-union" as="xs:anyAtomicType*"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="arg1" as="xs:anyAtomicType*"/>
  <xsl:param name="arg2" as="xs:anyAtomicType*"/>

  <xsl:sequence select="
  distinct-values(($arg1, $arg2))
 "/>

</xsl:function>

Examples

XPath ExampleResults
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 Also

functx:value-intersectThe intersection of two sequences of values
functx:value-exceptThe values in one sequence that aren't in another sequence

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26W3C XML Query Working Group, XQuery 1.0 and XPath 2.0 Functions and Operators, http://www.w3.org/TR/xpath-functions/
Datypic XSLT Services

Recommended Reading:

XQuery