home contribute faq download

FunctX XSLT Functions

functx:are-distinct-values

Whether all the values in a sequence are distinct

Google
Webxsltfunctions.com

Description

The functx:are-distinct-values function returns true if all of the values in the sequence are distinct; i.e., no one value appears more than once in the sequence. Distinctness is based on type equality.

Arguments and Return Type

NameTypeDescription
$seq xs:anyAtomicType* the sequence of values
return value xs:boolean

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:are-distinct-values" as="xs:boolean"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="seq" as="xs:anyAtomicType*"/>

  <xsl:sequence select="
   count(distinct-values($seq)) = count($seq)
 "/>

</xsl:function>

Examples

XSLT ExampleResults
<functx:are-distinct-values(>unctx:are-distinct-values( (1,2,1,3))
<false>alse
<functx:are-distinct-values(>unctx:are-distinct-values( (1,2,1,3,2.0))
<false>alse
<functx:are-distinct-values(>unctx:are-distinct-values( (1,2,3) )
<true>rue

See Also

functx:non-distinct-valuesReturns any values that appear more than once in a sequence
fn:distinct-valuesThe distinct atomic values in a sequence

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery