# FpML 4.5 Validation Rules - Functions

This is the shared functions part of the validation rule set accompanying the FpML 4.5 Working Draft.

This section introduces functions as a mechanism to define repeatable tests that are applied independent of a context. Functions take node-element types as parameters and return a typed result.

## Content

- Namespace
- Functions
  - different-frequencies
  - iff
  - same-currency

## Namespace

default namespace = http://www.fpml.org/2008/FpML-4-5

## Functions

Function: different-frequencies
All frequencies within the context of this rule must be different.

- parameter: $frequency (fpml:Interval) (min=2, max=*)

- result: true/false (xsd:boolean)

- test: All $frequency must not be the same

Function: iff
Return the logical "if and only if" of two xs:boolean operands. This is defined as (operand1 implies operand2) and (operand2 implies operand1). In simple terms, either both are true or neither is true.

- parameter: $p (xsd:boolean)
- parameter: $q (xsd:boolean)

- result: true/false (xsd:boolean)

- test: $p = $q

Function: same-currency
All instances of currency values within the context of this rule must be identical.

- parameter: $money (fpml:Money) (min=2, max=*)

- result: true/false (xsd:boolean)

- test: All ($money/currency and $money/currency/@currencyScheme) must be the same