From 0c4664e6bc4d9212f8203633d336aa01dbcd3be4 Mon Sep 17 00:00:00 2001 From: David Waltermire Date: Fri, 10 Nov 2023 12:32:45 +0100 Subject: [PATCH] Added let example to specification. --- .../specification/syntax/constraints.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/website/content/specification/syntax/constraints.md b/website/content/specification/syntax/constraints.md index 8a0e7d68..76456ffa 100644 --- a/website/content/specification/syntax/constraints.md +++ b/website/content/specification/syntax/constraints.md @@ -24,6 +24,37 @@ During constraint evaluation, each `let` statement MUST be evaluated in encounte During evaluation, when a variable is bound for a `let` statement, the variables value MUST be set to the result of evaluating the `@expression` using the current node as the Metapath evaluation focus. +For example: + +Given the following fragment of a Metaschema module. + +```xml + + + + + + + + +``` + +And the following document. + +```xml + + + + + + + + + +``` + +The expect constraint would pass for each `sibling` in the `parent` named "p1", and would fail for each `sibling` in the `parent` named "p2". + ## Enumerated values Additionally, flags may be constrained to a set of known values listed in advance.