From 1fb7128c2559c25bfbdd18c4e125129c23da0a8a Mon Sep 17 00:00:00 2001
From: galtm <40716346+galtm@users.noreply.github.com>
Date: Tue, 27 Sep 2022 09:22:37 -0400
Subject: [PATCH] Test modify phase, plus minor XSLT enhancements (#1321)
Most of the XSLT changes are to align with the latest specification.
XSLT
- Warn if set-parameter matches nothing
- Handle more types of children of param
- Make match="control" template handle both implicit and explicit binding
- New oscal:patches-to-id-targeting-ancestor function for processing
needed in multiple places
- For explicit binding that adds a title, add it after original title
to facilitate keeping the right one in finish phase
- For removal by class, expect exact match with no tokenization or
case insensitivity
- In finish phase, keep only last title of a control
XSpec
- Add tests at the level of individual templates and functions
---
.../oscal-profile-resolve-modify.xsl | 162 +-
.../testing/4_modified/modify.xspec | 1910 ++++++++++++++---
2 files changed, 1770 insertions(+), 302 deletions(-)
diff --git a/src/utils/util/resolver-pipeline/oscal-profile-resolve-modify.xsl b/src/utils/util/resolver-pipeline/oscal-profile-resolve-modify.xsl
index d49e6bf560..74d6315a29 100644
--- a/src/utils/util/resolver-pipeline/oscal-profile-resolve-modify.xsl
+++ b/src/utils/util/resolver-pipeline/oscal-profile-resolve-modify.xsl
@@ -1,20 +1,20 @@
-
-
+
-
+
@@ -26,115 +26,161 @@
+
-
+
+
+
+
+
+
+
+
+ set-parameter with param-id="{@param-id}" does not match any param id.
+ Warning
+
+
+
-
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+ got here! removable is
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
-
+
+
-
+
-
+
-
-
-
-
-
-
+
-
+
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/utils/util/resolver-pipeline/testing/4_modified/modify.xspec b/src/utils/util/resolver-pipeline/testing/4_modified/modify.xspec
index e1bea36470..40eb7e3026 100644
--- a/src/utils/util/resolver-pipeline/testing/4_modified/modify.xspec
+++ b/src/utils/util/resolver-pipeline/testing/4_modified/modify.xspec
@@ -1,301 +1,1723 @@
-
-
-
-
-
-
+ stylesheet="../../oscal-profile-resolve-modify.xsl"
+ xslt-version="3.0">
-
-
-
+
+
+
+ Control A
+
+
+ Context to consider
+
+
+
+
+
+
+
+
+
+
+
+
+ text
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- ABC Parameter
-
-
-
- choice 1
- choice 2
- choice 3
-
-
-
- Control A
-
- A 123 Parameter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ABC Parameter
-
+
choice 1
choice 2
choice 3
-
-
-
-
- New a123-1
-
-
-
- choice 1
-
-
-
-
-
-
-
-
- ABC Parameter
-
-
-
- choice 1
- choice 2
- choice 3
-
-
-
- Control A
-
- A 123 Parameter
- New a123-1
+
+ Control A
+
+ A 123 Parameter
+
+
+
+ choice 1
+ choice 2
+ choice 3
+
+
+
+
+
+
+ New a123-1
+
+
+
+ choice 1
+
+
+
+
+
+
+
+
+ ABC Parameter
-
+
choice 1
+ choice 2
+ choice 3
-
-
-
-
+
+ Control A
+
+ A 123 Parameter
+ New a123-1
+
+
+
+ choice 1
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+ Statement
+
+
+
+
+
+
+
+
+ Control A
+
+
+ Statement
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+ Context to consider
+ No context
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+ Context to consider
+
+
+
+
+
+
+
+
+ Control A
+
+
+ Context to consider
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
-
-
-
- Control A
-
-
-
-
-
-
-
-
-
-
-
-
- Control A
-
-
-
-
+
+
+
-
-
-
-
- Control A
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Control A
-
-
-
-
-
+
+
+
+
+
+
+ Parameter #1
+
+
+
+ at least every 3 years
+
+
+
+
+
+
-
-
-
-
- Control A
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Control A
-
-
-
-
-
+
+
+
+
+
+
+ Parameter #1
+
+
+
+ at least every 3 years
+
+
+
+
+
+
+
+
+
+ Parameter #1
+ at least every 3 years
+
+
+
+
+
+
+
+
+ Parameter #1
+ ORIGINAL constraint
+ ORIGINAL guideline
+ ORIGINAL remarks
+
+
+
+
+ NEW constraint
+ NEW guideline
+
+
+
+
+
+
+
+
+
+
+
+ Parameter #1
+ ORIGINAL constraint
+ NEW constraint
+ ORIGINAL guideline
+ NEW guideline
+ ORIGINAL remarks
+
+
+
+
+
+
+
+ Parameter #1
+ Usage
+ in the first quarter
+ ORIGINAL
+
+
+
+ Modified Parameter #1
+ at least every 3 years
+ NEW
+
+
+ NEW Usage
+
+
+ Further Modified Parameter #1
+ NEWER Usage
+ NEWER
+
+
+
+
+
+
+
+
+
+ Further Modified Parameter #1
+ NEWER Usage
+ in the first quarter
+ at least every 3 years
+ NEWER
+
+
+
+
+
+
+
+ Parameter #1
+ ORIGINAL
+
+
+ Parameter #2
+ ORIGINAL
+
+
+
+ NEW
+
+
+ 1
+
+
+ 1
+
+
+ NEW
+
+
+
+
+
+
+
+
+
+ Parameter #1
+ 1
+
+
+ Parameter #2
+ NEW
+
+
+
+
+
+
+
+ Parameter #1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameter #1
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+ New Title
+
+
+
+
+
+
+
+
+
+
+ Control A
+ New Title
+
+
+
+
+
+
+
+
+ Control A
+
+
+ Control A.1
+
+
+
+ Text
+
+
+
+
+
+
+
+
+
+ New Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A.1
+
+ New text
+
+
+
+
+ Text
+
+
+
+
+
+
+
+
+
+
+ Control A.1
+
+
+
+ Text
+
+
+ New text
+
+
+
+
+
+
+
+
+
+
+ Control A.1
+
+
+
+ Text
+
+
+ New text
+
+
+
+
+
+
+
+
+
+
+ New text
+
+
+ Control A.1
+
+
+
+ Text
+
+
+
+
+
+
+
+
+
+
+ Control A.1
+
+
+
+ Text
+
+
+
+ New text
+
+
+
+
+
+
+
+ Control A
+
+ Control A.1
+
+
+
+
+
+
+ New Title
+
+
+
+
+
+
+
+
+
+
+ Control A.1
+ New Title
+
+
+
+
+
+
+
+
+ Control A
+
+
+ Control A.1
+
+
+
+ Text
+
+
+
+
+
+
+
+ New Title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Control A
-
+
+
+
+ Text
+
+
+ Control A.1
+
+
+
+ Text
+
+
-
-
-
-
- Statement
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ Control A
+
+
+
+ Text
+
+
+
+
+
+
+ New text
+
+
+
+
+
+
+
+
+
+
+
Control A
-
-
- Statement
+
+
+
+ Text
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+ Control A1
+
+ Control A1-1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+ Control A1
+
+ Control A1-1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+ Control A1
+
+ Control A1-1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Control A
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ New text
+
+ Text
+
+ Text
+
+
+
+
+
+
+
+
+
+
+ Text
+
+ Text
+
+
+ New text
+
+
+
+
+
+
+
+
+
+
+ Text
+
+ Text
+
+
+ New text
+
+
+
+
+
+
+
+
+
+
+ New text
+
+
+ Text
+
+ Text
+
+
+
+
+
+
+
+
+
+
+ Text
+
+ Text
+
+
+
+ New text
+
+
+
+
+
+
+
+ Control A
+
+ Statement
+
+
+
+
+
+ New Title
+
+
+
+
+
+
+
+
+
+
+ Statement
+ New Title
+
+
+
+
+
+
+
+
+
+
+
+ New text
+
+ Text
+
+
+
+
+
+
+
+
+
+
+ New text
+
+ Text
+
+
+
+
+
+
+
+ Control A
+
+
+
+ Text
+
+
+ Text
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group X
+
+ Control X1
+
+
+
+
+
+
+ Context to consider
+
+ Control X2
+ Control X3
+
+
+ Group Z
+ Control Z1
+ Control Z2
+ Control Z3
+ Control Z3-A
+ Control Z3-A-1
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
- Control A
-
-
- Context to consider
+ Control Z3
+ Control Z3-A
+
+ Control Z3-A-1
+
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
-
- Control A
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
+
Control A
-
-
- Context to consider
- No context
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
- Control A
-
- Context to consider
-
-
-
-
-
+
+
-
+
Control A
-
-
- Context to consider
+
+
+
+ Text
+
+ Text
+
+
+
+ Control A.1
+
+
+
+ Text
+
+
-
-
-
+
+
+
+ New text
+
+
+
+
+
-
-
-
- Control A
-
-
-
-
-
-
-
-
- Parameter #1
-
-
- Control A
-
-
-
-
- at least every 3 years
-
-
-
-
-
-
-
- Parameter #1
- at least every 3 years
-
-
- Control A
-
-
-
-
-
-
-