Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair to profile checker Schematron #1013

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/utils/schematron/catalog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0"
uuid="6c303ebb-4a36-4534-8d7f-dd91644b1d53">
<metadata>
<title>Catalog</title>
<last-modified>2021-06-21T15:48:23.851-04:00</last-modified>
<version>0/1</version>
<oscal-version>1.0.0</oscal-version>
</metadata>
<param id="p2"/>
<control id="a1">
<title>Control A1</title>
</control>
<control id="a2">
<title>Control A1</title>
</control>
<control id="a3">
<title>Control A1</title>
</control>
</catalog>
2 changes: 1 addition & 1 deletion src/utils/schematron/oscal-profile.sch
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<sch:let name="importing" value="oscal:get-import(../parent::oscal:import)"/>
<sch:let name="not-a-catalog" value="empty($importing/oscal:catalog)"/>

<sch:assert test="$not-a-catalog or (string(.) = $importing//oscal:control/@id)">No control found with @id='<sch:value-of select="@control-id"/>'</sch:assert>
<sch:assert test="$not-a-catalog or (string(.) = $importing//oscal:control/@id)">No control found with @id='<sch:value-of select="string(.)"/>'</sch:assert>

<sch:assert test="count(key('control-call-by-id', string())) = 1">Control (<sch:value-of select="string(.)"/>) should not be referenced (either imported or excluded) more than once.</sch:assert>
<!--<sch:assert test="empty(key('call-by-id', string(), ..) except key('call-by-id', string(), ..) )">Control (<sch:value-of select="."/>) should not be both included and excluded, or invoked more than once.</sch:assert>-->
Expand Down
29 changes: 29 additions & 0 deletions src/utils/schematron/test-profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="oscal-profile.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<profile xmlns="http://csrc.nist.gov/ns/oscal/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/1.0 https://github.com/raw/usnistgov/OSCAL/v1.0.0/xml/schema/oscal_profile_schema.xsd"
uuid="7bb79729-781a-4034-85ef-a5c5c17d9daa">
<metadata>
<title/>
<last-modified>2021-08-23T17:19:41.79-04:00</last-modified>
<version>0.1</version>
<oscal-version>1.0.0</oscal-version>
</metadata>
<import href="#a1c12452-39a8-49ec-a4dc-549955270ba6">
<include-all/>
<exclude-controls>
<with-id>a1</with-id>
<with-id>a2</with-id>
</exclude-controls>
</import>
<modify>
<set-parameter param-id="p2"/>
<alter control-id="p2"/>
</modify>
<back-matter>
<resource uuid="a1c12452-39a8-49ec-a4dc-549955270ba6">
<rlink href="catalog.xml"/>
</resource>
</back-matter>
</profile>