Description
The functx:value-intersect function returns the intersection of the values in two sequences (values that appear in both sequences) in an implementation-defined order. It removes duplicates. This function is useful because the built-in intersect 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* |
XSLT Function Declaration| See XQuery definition. | | XSLT 2.0 Syntax: |
|---|
<xsl:function name="functx:value-intersect" 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| XSLT Example | Results |
|---|
functx:value-intersect((1,2),(2,3))
|
2
|
functx:value-intersect((1,2,3),(2,3,4))
|
(2, 3)
|
functx:value-intersect((1,2,2,3),(2,3))
|
(2, 3)
|
functx:value-intersect((1,2,2,3),())
|
()
|
See AlsoHistory |
|