Skip to content

Commit

Permalink
Updating Metaschema Schematron XSpecs to functional state: they are n…
Browse files Browse the repository at this point in the history
…ow stable, addressing #47
  • Loading branch information
wendellpiez committed Apr 12, 2022
1 parent 3992fc1 commit 3e5217f
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../toolchains/xslt-M4/validate/metaschema-check.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<METASCHEMA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/metaschema/1.0 ../../toolchains/xslt-M4/validate/metaschema.xsd"
xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/metaschema/1.0 ../../toolchains/xslt-M4/validate/metaschema.xsd" abstract="yes"
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0">

<schema-name>Included Metaschema</schema-name>
<schema-version>1.0</schema-version>
<short-name>included</short-name>
<namespace>http://csrc.nist.gov/ns/oscal/1.0</namespace>

<json-base-uri>http://csrc.nist.gov/ns/oscal/1.0</json-base-uri>

<define-assembly name="included-flags">
<formal-name>Assembly that includes global and local flags</formal-name>
<description>This assembly includes a flag defined in this included metaschema module.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<schema-version>1.0</schema-version>
<short-name>including</short-name>
<namespace>http://csrc.nist.gov/ns/oscal/1.0</namespace>
<json-base-uri>http://csrc.nist.gov/ns/oscal/1.0</json-base-uri>

<import href="included_metaschema.xml"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- Basic starter XSpec shows both callout and inline scenarios. -->

<x:scenario label="poc-on-remote-file">
<x:context href="shadow-importing_metaschema.xml"/>
<x:context href="including_metaschema.xml"/>

<x:scenario label="An example of a pre-publication QA step">
<!--<x:expect-not-assert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
schematron="../../../toolchains/xslt-M4/validate/metaschema-composition-check.sch">
schematron="../../../toolchains/xslt-M4/validate/metaschema-composition-check.sch"
run-as="external">

<x:param name="global-context" select="document('scope-local-importing_metaschema.xml')"/>
<!--<x:param name="global-context" select="document('scope-local-importing_metaschema.xml')"/>-->
<x:param name="allow-foreign">true</x:param>

<!-- Basic starter XSpec shows both callout and inline scenarios. -->
<x:scenario label="poc-on-remote-file">
<x:context href="scope-local-importing_metaschema.xml"/><!--
<x:context href="scope-local-importing_metaschema.xml"/><!--
<METASCHEMA xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0">
<short-name>boohoo</short-name>
</METASCHEMA>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<schema-version>0.0</schema-version>
<short-name>oscal-test</short-name>
<namespace>http://csrc.nist.gov/ns/metaschema/test</namespace>
<json-base-uri>http://csrc.nist.gov/ns/oscal/1.0</json-base-uri>

<remarks>
<p>For exercising Metaschema semantics with respect to modular assembly and composition.</p>
</remarks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<schema-version>0.0</schema-version>
<short-name>oscal-test</short-name>
<namespace>http://csrc.nist.gov/ns/metaschema/test</namespace>
<json-base-uri>http://csrc.nist.gov/ns/metaschema/test</json-base-uri>
<remarks>
<p>For exercising Metaschema semantics with respect to modular assembly and composition.</p>
</remarks>
Expand Down
7 changes: 2 additions & 5 deletions test-suite/metaschema-xspec/schematron/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

To run XSpec, we suggest either an XML IDE or a command line tool as described in [XSpec documentation in Github](https://github.com/xspec/xspec/wiki).


### NOT CURRENTLY FUNCTIONAL

* XSpec `metaschema-basic-schematron.xspec` testing Schematron: `../../../toolchains/xslt-M4/validate/metaschema-simple-check.sch`

*Needs updating and pointing to Schematron in its new location.*
*Needs updating and extension*

* XSpec `metaschema-composition-schematron.xspec` testing Schematron: `../../../toolchains/xslt-M4/validate/metaschema-composition-check.sch`

*Needs updating and pointing to Schematron in its new location*
*Needs updating and extension*

Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../toolchains/xslt-M4/validate/metaschema-check.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<METASCHEMA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/metaschema/1.0 ../../toolchains/xslt-M4/validate/metaschema.xsd"
xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/metaschema/1.0 ../../toolchains/xslt-M4/validate/metaschema.xsd" abstract="yes"
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0">

<schema-name>Imported Metaschema</schema-name>
<schema-version>1.0</schema-version>
<short-name>imported</short-name>
<namespace>http://csrc.nist.gov/ns/oscal/1.0</namespace>

<json-base-uri>http://csrc.nist.gov/ns/oscal/1.0</json-base-uri>

<define-assembly name="imported-flags">
<formal-name>Assembly that includes global and local flags</formal-name>
<description>This assembly references a global flag that is shadowed by a global flag defined in the importing metaschema.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<schema-version>1.0</schema-version>
<short-name>importing</short-name>
<namespace>http://csrc.nist.gov/ns/oscal/1.0</namespace>

<json-base-uri>http://csrc.nist.gov/ns/oscal/1.0</json-base-uri>

<import href="scope-local-imported_metaschema.xml"/>

<define-assembly name="importing-A">
Expand Down
2 changes: 1 addition & 1 deletion toolchains/xslt-M4/compose/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Single metaschema input, with its imports available, run in an XPrc pipeline wit
1. `metaschema-collect.xsl`
1. `metaschema-build-refs.xsl`
1. `metaschema-trim-extra-modules.xsl`
1. `metaschema-prune-unused-definitions-a9.xsl`
1. `metaschema-prune-unused-definitions.xsl`
1. `metaschema-resolve-use-names.xsl`
1. `metaschema-resolve-sibling-names.xsl`
1. `metaschema-digest.xsl`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- no need for helper <x:helper stylesheet="../metaschema-test-helper.xsl"/> -->

<x:scenario label="Pruning unused definitions">
<x:scenario label="When presented with unused definitions in a metaschema source">
<x:context>
<METASCHEMA module="nestedmessy">
<define-assembly name="unused-assembly" module="nestedmessy" _key-name="nestedmessy:unused-assembly">
Expand All @@ -30,7 +30,7 @@
</define-field>
</METASCHEMA>
</x:context>
<x:expect label="two unused definitions are detected and replaced">
<x:expect label="the unused definitions are detected and replaced">
<METASCHEMA module="nestedmessy">
<INFO info-type="objects-used">Seeing assembly#nestedmessy:BOX</INFO>
<EXCEPTION problem-type="unused-definition">REMOVING unused assembly definition for 'unused-assembly' from nestedmessy.</EXCEPTION>
Expand Down

0 comments on commit 3e5217f

Please sign in to comment.