# FpML 5.3 Validation Rules - Rules for Loan Messages

This is the Loan part of the validation rule set accompanying the FpML 5.3 Working Draft #2. The introductory section in the validation section of the specifications contains background information and documentation for this page.

The rules contained on this page contain links to cut down versions of valid and invalid test cases. The cut down test cases are non-normative and are provided for the purpose of documentation only.

## Content

- Namespace
- Functions
- Rules
- Rules with comments
  - ln-2

## Namespace

default element namespace = http://www.fpml.org/spec/fpml-5-3-2-wd-2

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

## Functions

The following shared functions are used in the rules.

- same-currency

## Rules

#### Unique contexts:

- LoanContract (complex type): ln-1
- DrawdownNotice (complex type): ln-2 ln-14 ln-15 ln-16 ln-17 ln-18 ln-19
- InterestRatePeriod (complex type): ln-3 ln-4 ln-5
- InterestAccrualSchedule (complex type): ln-6 ln-7 ln-8 ln-9
- FacilityNotice (complex type): ln-10 ln-11 ln-12 ln-30 ln-31
- LoanContractNotice (complex type): ln-11b ln-13
- InterestPaymentNotice (complex type): ln-20 ln-21
- LoanContractRepayment (complex type): ln-22
- RepaymentNotice (complex type): ln-24
- Repayment (complex type): ln-25 ln-26
- OneOffFeeNotice (complex type): ln-27 ln-28
- OneOffFeePayment (complex type): ln-29
- Deprecated rules
- Removed rules

ln-1 (Mandatory)
English Description:
Context: LoanContract (complex type)
currentInterestRatePeriod/startDate is greater than or equal to effectiveDate
XPath Description:
Context: LoanContract
currentInterestRatePeriod/startDate ge effectiveDate
ln-2 (Mandatory)
English Description:
Context: DrawdownNotice (complex type)
If loanContract exists, and if loanContract/currentInterestRatePeriod/floatingRateIndex contains the string "PRIME" then loanContract/currentInterestRatePeriod/rateFixingDate is equal to loanContract/effectiveDate.
XPath Description:
Context: DrawdownNotice
[exists(loanContract)] [loanContract/currentInterestRatePeriod/floatingRateIndex eq "PRIME"]
loanContract/currentInterestRatePeriod/rateFixingDate eq loanContract/effectiveDate
Comment: For a LoanContract the fixing date for the rate is always the effective date of the contract.
ln-3 (Mandatory)
English Description:
Context: InterestRatePeriod (complex type)
endDate is greater than or equal to startDate is greater than or equal to rateFixingDate.
XPath Description:
Context: InterestRatePeriod
endDate ge startDate ge rateFixingDate
ln-4 (Mandatory)
English Description:
Context: InterestRatePeriod (complex type)
If mandatoryCostRate doesn't exist, and if interestRate, and if margin and allInRate exist, then allInRate is equal to margin plus interestRate.
XPath Description:
Context: InterestRatePeriod
[not(exists(mandatoryCostRate))] [exists(interestRate)] [exists(margin)] [exists(allInRate)]
allInRate eq margin + interestRate
ln-5 (Mandatory)
English Description:
Context: InterestRatePeriod (complex type)
If mandatoryCostRate and interestRate and margin and allInRate exist, then allInRate is equal to margin plus interestRate plus mandatoryCostRate.
XPath Description:
Context: InterestRatePeriod
[exists(mandatoryCostRate)] [exists(interestRate)] [exists(margin)] [exists(allInRate)]
allInRate eq margin + interestRate + mandatoryCostRate
ln-6 (Mandatory)
English Description:
Context: InterestAccrualSchedule (complex type)
interestRatePeriod/startDate must be equal to lenderLoanContractPeriod/startDate must be equal to interestAccrualPeriod/startDate, in each period.
XPath Description:
Context: InterestAccrualSchedule
interestRatePeriod/startDate eq lenderLoanContractPeriod/startDate eq interestAccrualPeriod/startDate, in each period
ln-7 (Mandatory)
English Description:
Context: InterestAccrualSchedule (complex type)
If more than one interestRatePeriod exists, then the entire chronological series must form a contiguous block of interestRatePeriod.
XPath Description:
Context: InterestAccrualSchedule
[count(interestRatePeriod) gt 1]
every $startDate in $interestAccrualSchedule/interestRatePeriod[startDate gt min($interestAccrualSchedule/interestRatePeriod/startDate)]/startDate satisfies $startDate - "P1D" eq $interestAccrualSchedule/interestRatePeriod/endDate
ln-8 (Mandatory)
English Description:
Context: InterestAccrualSchedule (complex type)
If more than one lenderLoanContractPeriod exists, then the entire chronological series must form a contiguous block of lenderLoanContractPeriod.
XPath Description:
Context: InterestAccrualSchedule
[count(lenderLoanContractPeriod) gt 1]
every $startDate in $interestAccrualSchedule/lenderLoanContractPeriod[startDate gt min($interestAccrualSchedule/lenderLoanContractPeriod/startDate)]/startDate satisfies $startDate - "P1D" eq $interestAccrualSchedule/lenderLoanContractPeriod/endDate
ln-9 (Mandatory)
English Description:
Context: InterestAccrualSchedule (complex type)
If more than one interestAccrualPeriod exists, then the entire chronological series must form a contiguous block of interestAccrualPeriod.
XPath Description:
Context: InterestAccrualSchedule
[count(interestAccrualPeriod) gt 1]
every $startDate in $interestAccrualSchedule/interestAccrualPeriod[startDate gt min($interestAccrualSchedule/interestAccrualPeriod/startDate)]/startDate satisfies $startDate - "P1D" eq $interestAccrualSchedule/interestAccrualPeriod/endDate
ln-10 (Mandatory)
English Description:
Context: FacilityNotice (complex type)
If facilitySummary/originalCommitmentAmount and facilityCommitmentPosition/loanContractPosition/loanContractSummary/originalAmount exist, and if facilitySummary/originalCommitmentAmount and facilityCommitmentPosition/loanContractPosition/loanContractSummary/originalAmount have the same-currency, then facilitySummary/originalCommitmentAmount is greater than or equal to facilityCommitmentPosition/loanContractPosition/loanContractSummary/originalAmount.
XPath Description:
Context: FacilityNotice
[exists(facilitySummary/originalCommitmentAmount)] [exists(facilityCommitmentPosition/loanContractPosition/loanContractSummary/originalAmount)] [same-currency((facilitySummary/originalCommitmentAmount,facilityCommitmentPosition/loanContractPosition/loanContractSummary/originalAmount))]
facilitySummary/originalCommitmentAmount/amount ge facilityCommitmentPosition/loanContractPosition/loanContractSummary/originalAmount/amount
ln-11 (Mandatory)
English Description:
Context: FacilityNotice (complex type)
If facilityCommitmentPosition/loanContractPosition exists, and if facilityCommitmentPosition/currentAmount/shareAmount/amount and all facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount have the same-currency, then facilityCommitmentPosition/currentAmount/shareAmount/amount is greater than or equal to the sum of all facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount.
XPath Description:
Context: FacilityNotice
[exists(facilityCommitmentPosition/loanContractPosition)] [same-currency((facilityCommitmentPosition/currentAmount/shareAmount/amount,//facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount))]
facilityCommitmentPosition/currentAmount/shareAmount/amount ge sum(facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount)
ln-11b (Mandatory)
English Description:
Context: LoanContractNotice (complex type)
If facilityCommitmentPosition/loanContractPosition exists, and if facilityCommitmentPosition/currentAmount/shareAmount/amount and all facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount have the same-currency, then facilityCommitmentPosition/currentAmount/shareAmount/amount is greater than or equal to the sum of all facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount.
XPath Description:
Context: LoanContractNotice
[exists(facilityCommitmentPosition/loanContractPosition)] [same-currency((facilityCommitmentPosition/currentAmount/shareAmount/amount,//facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount))]
facilityCommitmentPosition/currentAmount/shareAmount/amount ge sum(facilityCommitmentPosition/loanContractPosition/currentAmount/shareAmount/amount)
ln-12 (Mandatory)
English Description:
Context: FacilityNotice (complex type)
If facilityCommitmentPosition/loanContractPosition exists, and if facilityCommitmentPosition/priorAmount/shareAmount/amount and all facilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount have the same-currency, then facilityCommitmentPosition/priorAmount/shareAmount/amount must be greater than or equal to the sum of all facilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount.
XPath Description:
Context: FacilityNotice
[exists(facilityCommitmentPosition/loanContractPosition)] [same-currency((facilityCommitmentPosition/priorAmount/shareAmount/amount,//facilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount))]
facilityCommitmentPosition/priorAmount/shareAmount/amount ge sum(facilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount)
ln-13 (Mandatory)
English Description:
Context: LoanContractNotice (complex type)
If facilityCommitmentPosition/loanContractPosition exists, and if facilityCommitmentPosition/priorAmount/shareAmount/amount and allfacilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount have the same-currency, then facilityCommitmentPosition/priorAmount/shareAmount/amount must be greater than or equal to the sum of all facilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount.
XPath Description:
Context: LoanContractNotice
[exists(facilityCommitmentPosition/loanContractPosition)] [same-currency((facilityCommitmentPosition/priorAmount/shareAmount/amount,//facilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount))]
facilityCommitmentPosition/priorAmount/shareAmount/amount ge sum(facilityCommitmentPosition/loanContractPosition/priorAmount/shareAmount/amount)
ln-14 (Mandatory)
English Description:
Context: DrawdownNotice (complex type)
If loanContract exists, then drawdownPayment/paymentDate is greater than or equal to loanContract/effectiveDate
XPath Description:
Context: DrawdownNotice
[exists(loanContract)]
drawdownPayment/paymentDate ge loanContract/effectiveDate
ln-15 (Mandatory)
English Description:
Context: DrawdownNotice (complex type)
If dealSummary/creditAgreementDate exists, then loanContract/effectiveDate is greater than or equal to dealSummary/creditAgreementDate and drawdownPayment/paymentDate is greater than or equal to dealSummary/creditAgreementDate.
XPath Description:
Context: DrawdownNotice
[exists(dealSummary/creditAgreementDate)]
(loanContract/effectiveDate ge dealSummary/creditAgreementDate) and (drawdownPayment/paymentDate ge dealSummary/creditAgreementDate)
ln-16 (Mandatory)
English Description:
Context: DrawdownNotice (complex type)
If facilityCommitmentPosition/priorAmount/shareAmount exists, and if facilityCommitmentPosition/priorAmount/shareAmount/amount and drawdownPayment/shareLoanContractAmount/amount have the same-currency, then drawdownPayment/shareLoanContractAmount/amount is less than or equal to facilityCommitmentPosition/priorAmount/shareAmount/amount
XPath Description:
Context: DrawdownNotice
[exists(facilityCommitmentPosition/priorAmount/shareAmount)] [same-currency((facilityCommitmentPosition/priorAmount/shareAmount/amount,drawdownPayment/shareLoanContractAmount/amount))]
drawdownPayment/shareLoanContractAmount/amount le facilityCommitmentPosition/priorAmount/shareAmount/amount
ln-17 (Mandatory)
English Description:
Context: DrawdownNotice (complex type)
If loanContract exists, and if loanContract/amount/amount and drawdownPayment/shareLoanContractAmount/amount have the same-currency, then loanContract/amount/amount is greater than or equal to drawdownPayment/shareLoanContractAmount/amount
XPath Description:
Context: DrawdownNotice
[exists(loanContract)] [same-currency((loanContract/amount/amount,drawdownPayment/shareLoanContractAmount/amount))]
loanContract/amount/amount ge drawdownPayment/shareLoanContractAmount/amount
ln-18 (Mandatory)
English Description:
Context: DrawdownNotice (complex type)
If loanContractSummary exists, and if loanContractSummary/originalAmount/amount and drawdownPayment/shareLoanContractAmount/amount have the same-currency, then loanContractSummary/originalAmount/amount is greater than or equal to drawdownPayment/shareLoanContractAmount/amount.
XPath Description:
Context: DrawdownNotice
[exists(loanContractSummary)] [same-currency((loanContractSummary/originalAmount/amount,drawdownPayment/shareLoanContractAmount/amount))]
loanContractSummary/originalAmount/amount ge drawdownPayment/shareLoanContractAmount/amount
ln-19 (Mandatory)
English Description:
Context: DrawdownNotice (complex type)
If drawdownEventType is equal to "RateSetEvent", and if loanContract exists, then loanContract/currentInterestRatePeriod/interestRate and loanContract/currentInterestRatePeriod/margin and loanContract/currentInterestRatePeriod/allInRate and loanContract/currentInterestRatePeriod/interestDayBasis and loanContract/currentInterestRatePeriod/indexTenor must exist.
XPath Description:
Context: DrawdownNotice
[drawdownEventType eq "RateSetEvent"] [exists(loanContract)]
exists(loanContract/currentInterestRatePeriod/interestRate) and exists(loanContract/currentInterestRatePeriod/margin) and exists(loanContract/currentInterestRatePeriod/allInRate) and exists(loanContract/currentInterestRatePeriod/interestDayBasis) and exists(loanContract/currentInterestRatePeriod/indexTenor)
ln-20 (Mandatory)
English Description:
Context: InterestPaymentNotice (complex type)
If interestPayment/amount/shareAmount/amount and all interestAccrualSchedule/interestAccrualPeriod/shareInterestAccrualAmount/amount have the same-currency , then interestPayment/amount/shareAmount/amount must be equal to the sum of all interestAccrualSchedule/interestAccrualPeriod/shareInterestAccrualAmount/amount.
XPath Description:
Context: InterestPaymentNotice
[same-currency((interestPayment/amount/shareAmount/amount,//interestAccrualSchedule/interestAccrualPeriod/shareInterestAccrualAmount/amount))]
interestPayment/amount/shareAmount/amount eq sum(interestAccrualSchedule/interestAccrualPeriod/shareInterestAccrualAmount/amount)
ln-21 (Mandatory)
English Description:
Context: InterestPaymentNotice (complex type)
interestAccrualSchedule/interestRatePeriod/interestRate and interestAccrualSchedule/interestRatePeriod/margin and interestAccrualSchedule/interestRatePeriod/allInRate and interestAccrualSchedule/interestRatePeriod/interestDayBasis and interestAccrualSchedule/interestRatePeriod/indexTenor must exist.
XPath Description:
Context: InterestPaymentNotice
exists(interestAccrualSchedule/interestRatePeriod/interestRate) and exists(interestAccrualSchedule/interestRatePeriod/margin) and exists(interestAccrualSchedule/interestRatePeriod/allInRate) and exists(interestAccrualSchedule/interestRatePeriod/interestDayBasis) and exists(interestAccrualSchedule/interestRatePeriod/indexTenor)
ln-22 (Mandatory)
English Description:
Context: LoanContractRepayment (complex type)
If loanContractSummary/originalAmount exists, and if loanContractSummary/originalAmount/amount and amount/globalAmount/amount have the same-currency, then loanContractSummary/originalAmount/amount is greater than or equal to amount/globalAmount/amount.
XPath Description:
Context: LoanContractRepayment
[exists(loanContractSummary/originalAmount)] [same-currency((loanContractSummary/originalAmount/amount,amount/globalAmount/amount))]
loanContractSummary/originalAmount/amount ge amount/globalAmount/amount
ln-24 (Mandatory)
English Description:
Context: RepaymentNotice (complex type)
If facilityCommitmentPosition exists and if facilityCommitmentPosition/priorAmount/shareAmount/amount and repayment/facilityRepayment/amount/shareAmount/amount have the same-currency, then facilityCommitmentPosition/priorAmount/shareAmount/amountis greater than or equal to repayment/facilityRepayment/amount/shareAmount/amount.
XPath Description:
Context: RepaymentNotice
[exists(facilityCommitmentPosition)] [same-currency((facilityCommitmentPosition/priorAmount/shareAmount/amount,repayment/facilityRepayment/amount/shareAmount/amount))]
facilityCommitmentPosition/priorAmount/shareAmount/amount ge repayment/facilityRepayment/amount/shareAmount/amount
ln-25 (Mandatory)
English Description:
Context: Repayment (complex type)
If facilityRepayment/amount/shareAmount/amount and all loanContractRepayment/amount/shareAmount/amount have the same-currency, then facilityRepayment/amount/shareAmount/amount must be greater than or equal to the sum of all loanContractRepayment/amount/shareAmount/amount.
XPath Description:
Context: Repayment
[same-currency((facilityRepayment/amount/shareAmount/amount,//loanContractRepayment/amount/shareAmount/amount))]
facilityRepayment/amount/shareAmount/amount ge sum(loanContractRepayment/amount/shareAmount/amount)
ln-26 (Mandatory)
English Description:
Context: Repayment (complex type)
If loanContractRepayment/amount/globalAmount exists, and if facilityRepayment/amount/globalAmount/amount and all loanContractRepayment/amount/globalAmount/amount have the same-currency, then facilityRepayment/amount/globalAmount/amount must be greater than or equal to the sum of all loanContractRepayment/amount/globalAmount/amount.
XPath Description:
Context: Repayment
[exists(loanContractRepayment/amount/globalAmount)] [same-currency((facilityRepayment/amount/globalAmount/amount,//loanContractRepayment/amount/globalAmount/amount))]
facilityRepayment/amount/globalAmount/amount ge sum(loanContractRepayment/amount/globalAmount/amount)
ln-27 (Mandatory)
English Description:
Context: OneOffFeeNotice (complex type)
If feePayment/feeType is equal to "BreakageFee", then loanContractSummary must exist.
XPath Description:
Context: OneOffFeeNotice
[feePayment/feeType eq "BreakageFee"]
exists(loanContractSummary)
ln-28 (Mandatory)
English Description:
Context: OneOffFeeNotice (complex type)
If feePayment/feeType is equal to "AssignmentFee", then loanContractSummary must not exist.
XPath Description:
Context: OneOffFeeNotice
[feePayment/feeType eq "AssignmentFee"]
not(exists((loanContractSummary))
ln-29 (Mandatory)
English Description:
Context: OneOffFeePayment (complex type)
paymentDate is greater than or equal to effectiveDate
XPath Description:
Context: OneOffFeePayment
paymentDate ge effectiveDate
ln-30 (Mandatory)
English Description:
Context: FacilityNotice (complex type)
If facilityCommitmentPosition/loanContractPosition/currentAmount/globalAmount and facilityCommitmentPosition/currentAmount/globalAmount exist, and if facilityCommitmentPosition/currentAmount/globalAmount/amount and all facilityCommitmentPosition/loanContractPosition/currentAmount/globalAmount have the same-currency, then facilityCommitmentPosition/currentAmount/globalAmount/amount is greater than or equal to the sum of all facilityCommitmentPosition/loanContractPosition/currentAmount/globalAmount/amount.
XPath Description:
Context: FacilityNotice
[exists(facilityCommitmentPosition/loanContractPosition/currentAmount/globalAmount)] [exists(facilityCommitmentPosition/currentAmount/globalAmount)] [same-currency((facilityCommitmentPosition/currentAmount/globalAmount/amount,//facilityCommitmentPosition/loanContractPosition/currentAmount/globalAmount))]
facilityCommitmentPosition/currentAmount/globalAmount/amount ge sum(facilityCommitmentPosition/loanContractPosition/currentAmount/globalAmount/amount)
ln-31 (Mandatory)
English Description:
Context: FacilityNotice (complex type)
If facilityCommitmentPosition/loanContractPosition/priorAmount/globalAmount and facilityCommitmentPosition/priorAmount/globalAmount exist, and if facilityCommitmentPosition/priorAmount/globalAmount/amount and all facilityCommitmentPosition/loanContractPosition/priorAmount/globalAmount/amount have the same-currency, then facilityCommitmentPosition/priorAmount/globalAmount/amountis greater than or equal to the sum of all facilityCommitmentPosition/loanContractPosition/priorAmount/globalAmount/amount.
XPath Description:
Context: FacilityNotice
[exists(facilityCommitmentPosition/loanContractPosition/priorAmount/globalAmount)] [exists(facilityCommitmentPosition/priorAmount/globalAmount)] [same-currency((facilityCommitmentPosition/priorAmount/globalAmount/amount,//facilityCommitmentPosition/loanContractPosition/priorAmount/globalAmount/amount))]
facilityCommitmentPosition/priorAmount/globalAmount/amount ge sum(facilityCommitmentPosition/loanContractPosition/priorAmount/globalAmount/amount)

#### Deprecated rules

#### Removed rules

ln-23 (Mandatory)
REMOVED: Context: Repayment: If facilityRepayment/amount/globalAmount/amount and all loanContractRepayment/loanContractSummary/originalAmount/amount have the same-currency, then facilityRepayment/amount/globalAmount/amount must be greater than or equal to the sum of all loanContractRepayment/loanContractSummary/originalAmount/amount. Rationale for removal: Rule ln-23 is incorrectly defined since there is no credible relationship between the original amount of a loan contract and the repayment occurring at a point in time in the future after that..