.parent()
| Description: |
.parent() navigates to the parent of the element. It can be used to reach over the context of the rule. |
| Available for: |
any element |
| Parameters: | parent element type |
| Return type: | element |
Example 1
| Context: | CreditTransferTransactionInformation |
| OCL: | self.parent(PaymentInstructionInformation).PmtTpInf.SvcLvl.Cd.matches("SEPA") |
| Description: | The example rule checks if the parent element has Service level code populated with value SEPA. |
The XML snippet below would pass this check.
<PmtInf>
<PmtInfId>1234</PmtInfId>
<PmtMtd>TRF</PmtMtd>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
</PmtTpInf>
<ReqdExctnDt>2023-01-01</ReqdExctnDt>
...
<CdtTrfTxInf>
<PmtId>
<EndToEndId>12345</EndToEndId>
</PmtId>
<Amt>
<InstdAmt Ccy="EUR">100</InstdAmt>
</Amt>
...
</CdtTrfTxInf>
</PmtInf>
The other snippet below however would not pass this check as the value is different from "SEPA".
<PmtInf>
<PmtInfId>1234</PmtInfId>
<PmtMtd>TRF</PmtMtd>
<PmtTpInf>
<SvcLvl>
<Cd>NURG</Cd>
</SvcLvl>
</PmtTpInf>
<ReqdExctnDt>2023-01-01</ReqdExctnDt>
...
<CdtTrfTxInf>
<PmtId>
<EndToEndId>12345</EndToEndId>
</PmtId>
<Amt>
<InstdAmt Ccy="EUR">100</InstdAmt>
</Amt>
...
</CdtTrfTxInf>
</PmtInf>
With parent method is good to note that if you for example have a notice that is directed to the GrpHdr level that stems from the PmtInf level, even though you might have multiple PmtInf's in the file, the notice will only be generated once.