# FpML 5.3 Validation Rules - Rules for Messaging (recordkeeping view)

This section is the constraints that implement the Business Process definition and Messaging definition in the FpML 5.3 Last Call Working Draft.

These constraints apply to the set of all known messages to validate the Business Process and Messaging definitions. The rules are tested by applying to the collection of all messages available, both sent and received. Each message is referred to as a "document", as this meets the requirement to use XPath 2.0 for paths.

The constraints are written as invariant rules that return "false" when they are failed and "true" when they are satisfied. The constraints are written to accommodate the open world assumption that there may be other messages that are not yet known about. For example messages that have not yet been sent or arrived are unknown.

A subset of constraints is identified as "Warnings". These constraints are used when knowledge from a message is expected but absent and it is impossible to distinguish between the messages being incorrect and the message not yet being known about. For example a Request might not yet be known about to match to a Response.

The constraints that are not "Warnings" are termed "Mandatory" constraints, which is consistent with all other rules.

## Content

- Namespace
- Functions
- Rules
- Rules with comments
  - msg-1
  - msg-2
  - msg-3
  - msg-4
  - msg-5

## Namespace

default element namespace = http://www.fpml.org/spec/fpml-5-3-4-lcwd-1

namespace xs = http://www.w3.org/2001/XMLSchema

## Functions

The following shared functions are used in the rules.

- fpml:deep-equal

## Rules

#### Unique contexts:

- collection(): msg-1 msg-2 msg-3 msg-4
- document(): msg-5
- Deprecated rules
- Removed rules

msg-1 (rule does not apply to this view)
msg-2 (rule does not apply to this view)
msg-3 (rule does not apply to this view)
msg-4 (rule does not apply to this view)
msg-5 (Mandatory)
English Description:
Context: document()
If the message does not contain a novation element, the maximum number of onBehalfOf elements must be 2.
XPath Description:
Context: document()
[exists(onBehalfOf)] [not(exists(novation))]
count(onBehalfOf) le 2
Comment: the use of 3 or 4 onBehalfOf elements can only occur in a novation scenario.
Test cases:

#### Deprecated rules

#### Removed rules