From 39f2702593e81af285dfe7133418f1d6faa2d860 Mon Sep 17 00:00:00 2001 From: David Waltermire Date: Sun, 6 Jun 2021 11:56:21 -0400 Subject: [PATCH] Feature pipeline refactor 2021 05 (#152) * Rework of docs focusing on JSON docs and model pipeline * Improvements to composition toolchain * Fixed a few small bugs in the metaschema-check. Improved performance of the compose pruning using an accumulator. * Moved edge-case samples into testing directory * Made shadowing warning a warning * Initial commit of an Oxygen Metaschema framework. * Creation of new compose schematron unit tests. * Cross-linking XML and JSON syntax pages and other improvements to links * Now building XML and JSON indexes to reference pages, with links to steps * Reconfigured docs pipeline (XSLT entry points); adding new files including pipeline steps * Migrating schema generation tools to new/improved composition pipeline * Addressing usnistgov/OSCAL#902 thanks for finding this bug * Enhancements to JSON Schema definition (with better performance too) * Adding support for json-base-uri as a metaschema property * Updated JSON schema $id; factoring out common docs XSLT * Fixing IDs in JSON schema per issue usnistgov/OSCAL#933. * Addressing datatype validation issues: whitespace collapsing; non-empty values; ncname-workalike in JSON Schema - see usnistgov/OSCAL#911 usnistgov/OSCAL#805 also #33 #67 #68 * Improvements to XSD production; fully aligning 'token' datatype across XSD and JSON Schema implementations. * Updating bidirectional XML/JSON converter generators (#143) * Committing a version that handles test data correctly (so far) from rebuilt metaschema composition addressing #51 #53 #76 * Now displaying constraints in documentation at point of definition; * Docs generation revamp Reworked reference and other pages to sketch - #128 and others Co-authored-by: Wendell Piez --- .gitignore | 1 + .gitmodules | 4 + scripts/generate-content-converter.sh | 8 +- scripts/include/init-calabash.sh | 30 + scripts/include/init-saxon.sh | 11 +- .../metaschema/metaschema.framework | 908 +++++++++++ support/xspec | 1 + test-suite/docs-models/models_metaschema.xml | 40 +- .../metaschema-xspec/included_metaschema.xml | 36 + .../metaschema-xspec/including_metaschema.xml | 46 + .../metaschema-basic-schematron-result.html | 679 ++++++++ .../metaschema-basic-schematron.xspec | 40 + ...aschema-composition-schematron-result.html | 643 ++++++++ .../metaschema-composition-schematron.xspec | 28 + .../problem01-module_metaschema.xml | 0 .../problem01_metaschema.xml | 16 +- .../scope-local-imported_metaschema.xml | 26 + .../scope-local-importing_metaschema.xml | 31 + .../xslt-M4/compose/annotate-composition.xsl | 84 + .../xslt-M4/compose/annotate-model-map.xsl | 94 ++ toolchains/xslt-M4/compose/make-model-map.xsl | 163 +- .../xslt-M4/compose/metaschema-build-refs.xsl | 131 ++ .../xslt-M4/compose/metaschema-collect.xsl | 162 +- .../compose/metaschema-compose-debug.xpl | 74 - .../xslt-M4/compose/metaschema-compose.xpl | 213 +++ .../xslt-M4/compose/metaschema-digest.xsl | 25 +- .../metaschema-prune-unused-definitions.xsl | 118 ++ .../xslt-M4/compose/metaschema-reduce1.xsl | 113 -- .../xslt-M4/compose/metaschema-reduce2.xsl | 178 --- .../metaschema-resolve-sibling-names.xsl | 48 + .../compose/metaschema-resolve-use-names.xsl | 86 + .../compose/metaschema-trim-extra-modules.xsl | 23 + toolchains/xslt-M4/compose/reduce-map.xsl | 8 +- .../testing/1_collected/collect-report.html | 647 +++++++- .../testing/1_collected/collect-result.html | 350 +++- .../compose/testing/1_collected/collect.xspec | 58 +- .../working_metaschema-COLLECTED.xml | 85 +- .../compose/testing/models_metaschema.xml | 293 ++++ .../xslt-M4/compose/unfold-model-map.xsl | 30 +- .../converter-gen/produce-json-converter.xsl | 26 + .../converter-gen/produce-xml-converter.xsl | 82 +- .../converter-gen/supermodel-to-json.xsl | 17 +- .../xslt-M4/document/common-definitions.xsl | 331 ++++ .../xslt-M4/document/common-reference.xsl | 320 ++++ .../xslt-M4/document/hugo-css-emulator.xsl | 426 +++++ .../document/json/json-definitions.xsl | 133 ++ .../document/json/json-docs-hugo-uswds.xsl | 139 +- .../xslt-M4/document/json/notation-spec.html | 136 ++ .../document/json/object-index-html.xsl | 75 + .../xslt-M4/document/json/object-map-html.xsl | 75 +- .../document/json/object-reference-html.xsl | 195 +++ .../xslt-M4/document/json/object-tree.xsl | 71 +- .../make-schema-reference-index-html.xsl | 43 + .../xslt-M4/document/pipeline-diagnostic.xsl | 18 + .../document/xml/element-index-html.xsl | 88 + .../xslt-M4/document/xml/element-map-html.xsl | 50 +- .../document/xml/element-reference-html.xsl | 161 ++ .../xslt-M4/document/xml/element-tree.xsl | 40 +- .../xslt-M4/document/xml/xml-definitions.xsl | 144 ++ .../document/xml/xml-docs-hugo-uswds.xsl | 65 +- toolchains/xslt-M4/init.sh | 7 +- .../xslt-M4/make-any-metaschema-docs.xpl | 364 +++++ .../xslt-M4/make-hugo-metaschema-docs.xpl | 322 ++++ .../xslt-M4/make-metaschema-converters.xpl | 79 +- toolchains/xslt-M4/make-metaschema-docs.xpl | 106 -- .../xslt-M4/make-metaschema-json-schema.xpl | 2 +- .../xslt-M4/make-metaschema-model-maps.xpl | 135 -- toolchains/xslt-M4/make-metaschema-xsd.xpl | 2 +- toolchains/xslt-M4/metapath/docs-metapath.xsl | 87 +- .../metapath/metapath-casting-report.html | 38 +- .../metapath/metapath-casting-result.html | 554 ++++--- .../xslt-M4/metapath/metapath-casting.xspec | 1 + .../xslt-M4/metapath/metapath-docs.xspec | 24 + .../xslt-M4/metapath/metapath-jsonize.xsl | 106 +- .../metapath/metapath-jsonizing-result.html | 624 +++++--- .../xslt-M4/metapath/metapath-jsonizing.xspec | 47 +- toolchains/xslt-M4/metaschema-compose.xpl | 74 - .../xslt-M4/nist-metaschema-COMPOSE.xsl | 6 +- .../nist-metaschema-MAKE-JSON-DOCS.xsl | 37 - .../xslt-M4/nist-metaschema-MAKE-JSON-MAP.xsl | 41 - .../nist-metaschema-MAKE-JSON-SCHEMA.xsl | 9 +- ...-metaschema-MAKE-JSON-TO-XML-CONVERTER.xsl | 8 +- .../xslt-M4/nist-metaschema-MAKE-XML-DOCS.xsl | 38 - .../xslt-M4/nist-metaschema-MAKE-XML-MAP.xsl | 41 - ...-metaschema-MAKE-XML-TO-JSON-CONVERTER.xsl | 8 +- .../xslt-M4/nist-metaschema-MAKE-XSD.xsl | 9 +- .../schema-gen/make-json-schema-metamap.xsl | 129 +- .../schema-gen/make-metaschema-xsd.xsl | 46 +- .../xslt-M4/schema-gen/oscal-datatypes.xsd | 47 +- .../xslt-M4/testing/models-testdata.xml | 20 +- .../xslt-M4/testing/models_metaschema.xml | 66 +- .../testing/models_metaschema_XML-SCHEMA.xsd | 312 +++- .../testing/test-xml-json-roundtrip.xpl | 2 +- .../xslt-M4/testing/testdata-supermodel.xml | 1424 ++++++++++++++--- .../xslt-M4/validate/metaschema-check.sch | 66 +- .../xslt-M4/validate/metaschema-compose.xsl | 17 +- .../validate/metaschema-composition-check.sch | 329 ++++ .../xslt-M4/validate/metaschema-digest.xsl | 10 +- .../validate/metaschema-simple-check.sch | 18 + .../metaschema-validation-support.xsl | 11 +- toolchains/xslt-M4/validate/metaschema.xsd | 35 +- .../circular-import_module_metaschema.xml | 13 + .../circular-import_top-level_metaschema.xml | 13 + ...duplicate-short-name_module_metaschema.xml | 16 + ...licate-short-name_top-level_metaschema.xml | 24 + .../instances/shadow-imported_metaschema.xml | 24 + .../instances/shadow-importing_metaschema.xml | 50 + .../metaschema-composition-schematron.xspec | 130 ++ .../xslt-M4/write-hugo-metaschema-docs.xpl | 289 ++++ website/themes/uswds | 2 +- 110 files changed, 11602 insertions(+), 2426 deletions(-) create mode 100644 scripts/include/init-calabash.sh create mode 100644 support/oxygen/frameworks/metaschema/metaschema.framework create mode 160000 support/xspec create mode 100644 test-suite/metaschema-xspec/included_metaschema.xml create mode 100644 test-suite/metaschema-xspec/including_metaschema.xml create mode 100644 test-suite/metaschema-xspec/metaschema-basic-schematron-result.html create mode 100644 test-suite/metaschema-xspec/metaschema-basic-schematron.xspec create mode 100644 test-suite/metaschema-xspec/metaschema-composition-schematron-result.html create mode 100644 test-suite/metaschema-xspec/metaschema-composition-schematron.xspec rename {toolchains/xslt-M4/compose/testing => test-suite/metaschema-xspec}/problem01-module_metaschema.xml (100%) rename {toolchains/xslt-M4/compose/testing => test-suite/metaschema-xspec}/problem01_metaschema.xml (76%) create mode 100644 test-suite/metaschema-xspec/scope-local-imported_metaschema.xml create mode 100644 test-suite/metaschema-xspec/scope-local-importing_metaschema.xml create mode 100644 toolchains/xslt-M4/compose/annotate-composition.xsl create mode 100644 toolchains/xslt-M4/compose/annotate-model-map.xsl create mode 100644 toolchains/xslt-M4/compose/metaschema-build-refs.xsl delete mode 100644 toolchains/xslt-M4/compose/metaschema-compose-debug.xpl create mode 100644 toolchains/xslt-M4/compose/metaschema-compose.xpl create mode 100644 toolchains/xslt-M4/compose/metaschema-prune-unused-definitions.xsl delete mode 100644 toolchains/xslt-M4/compose/metaschema-reduce1.xsl delete mode 100644 toolchains/xslt-M4/compose/metaschema-reduce2.xsl create mode 100644 toolchains/xslt-M4/compose/metaschema-resolve-sibling-names.xsl create mode 100644 toolchains/xslt-M4/compose/metaschema-resolve-use-names.xsl create mode 100644 toolchains/xslt-M4/compose/metaschema-trim-extra-modules.xsl create mode 100644 toolchains/xslt-M4/compose/testing/models_metaschema.xml create mode 100644 toolchains/xslt-M4/document/common-definitions.xsl create mode 100644 toolchains/xslt-M4/document/common-reference.xsl create mode 100644 toolchains/xslt-M4/document/hugo-css-emulator.xsl create mode 100644 toolchains/xslt-M4/document/json/json-definitions.xsl create mode 100644 toolchains/xslt-M4/document/json/notation-spec.html create mode 100644 toolchains/xslt-M4/document/json/object-index-html.xsl create mode 100644 toolchains/xslt-M4/document/json/object-reference-html.xsl create mode 100644 toolchains/xslt-M4/document/make-schema-reference-index-html.xsl create mode 100644 toolchains/xslt-M4/document/pipeline-diagnostic.xsl create mode 100644 toolchains/xslt-M4/document/xml/element-index-html.xsl create mode 100644 toolchains/xslt-M4/document/xml/element-reference-html.xsl create mode 100644 toolchains/xslt-M4/document/xml/xml-definitions.xsl create mode 100644 toolchains/xslt-M4/make-any-metaschema-docs.xpl create mode 100644 toolchains/xslt-M4/make-hugo-metaschema-docs.xpl delete mode 100644 toolchains/xslt-M4/make-metaschema-docs.xpl delete mode 100644 toolchains/xslt-M4/make-metaschema-model-maps.xpl delete mode 100644 toolchains/xslt-M4/metaschema-compose.xpl delete mode 100644 toolchains/xslt-M4/nist-metaschema-MAKE-JSON-DOCS.xsl delete mode 100644 toolchains/xslt-M4/nist-metaschema-MAKE-JSON-MAP.xsl delete mode 100644 toolchains/xslt-M4/nist-metaschema-MAKE-XML-DOCS.xsl delete mode 100644 toolchains/xslt-M4/nist-metaschema-MAKE-XML-MAP.xsl create mode 100644 toolchains/xslt-M4/validate/metaschema-composition-check.sch create mode 100644 toolchains/xslt-M4/validate/metaschema-simple-check.sch create mode 100644 toolchains/xslt-M4/validate/xspec/instances/circular-import_module_metaschema.xml create mode 100644 toolchains/xslt-M4/validate/xspec/instances/circular-import_top-level_metaschema.xml create mode 100644 toolchains/xslt-M4/validate/xspec/instances/duplicate-short-name_module_metaschema.xml create mode 100644 toolchains/xslt-M4/validate/xspec/instances/duplicate-short-name_top-level_metaschema.xml create mode 100644 toolchains/xslt-M4/validate/xspec/instances/shadow-imported_metaschema.xml create mode 100644 toolchains/xslt-M4/validate/xspec/instances/shadow-importing_metaschema.xml create mode 100644 toolchains/xslt-M4/validate/xspec/metaschema-composition-schematron.xspec create mode 100644 toolchains/xslt-M4/write-hugo-metaschema-docs.xpl diff --git a/.gitignore b/.gitignore index db88a16e..26ea91e3 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ # other generated files nohup.out +/toolchains/xslt-M4/validate/xspec/metaschema-composition-schematron-result.html diff --git a/.gitmodules b/.gitmodules index 20dbca5a..03910762 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,7 @@ path = support/schematron url = https://github.com/usnistgov/schematron.git branch = master +[submodule "support/xspec"] + path = support/xspec + url = https://github.com/xspec/xspec.git + branch = d8bbeca51eaccc8b3e07c82547f6aff4a2072aef diff --git a/scripts/generate-content-converter.sh b/scripts/generate-content-converter.sh index b009ff54..ba3e763f 100755 --- a/scripts/generate-content-converter.sh +++ b/scripts/generate-content-converter.sh @@ -126,12 +126,12 @@ fi result=$(generate_converter "$METASCHEMA" "$GENERATED_CONVERTER" "${GENERATE_SOURCE_FORMAT}" "${GENERATE_TARGET_FORMAT}" 2>&1) cmd_exitcode=$? if [ $cmd_exitcode -ne 0 ]; then - - echo -e "${P_ERROR}Generating ${GENERATE_SOURCE_FORMAT^^} to ${GENERATE_TARGET_FORMAT^^} converter failed for '${P_END}${METASCHEMA_RELATIVE_PATH}${P_ERROR}'.${P_END}" - echo -e "${P_ERROR}${result}${P_END}" - exitcode=1 + >&2 echo -e "${P_ERROR}Generating ${GENERATE_SOURCE_FORMAT^^} to ${GENERATE_TARGET_FORMAT^^} converter failed for '${P_END}${METASCHEMA_RELATIVE_PATH}${P_ERROR}'.${P_END}" + >&2 echo -e "${P_ERROR}${result}${P_END}" + exit 1; else echo -e "${P_OK}Generated ${GENERATE_SOURCE_FORMAT^^} to ${GENERATE_TARGET_FORMAT^^} converter for '${P_END}${METASCHEMA_RELATIVE_PATH}${P_OK}' as '${P_END}${GENERATED_CONVERTER_RELATIVE}${P_INFO}'.${P_END}" fi +exit 0; diff --git a/scripts/include/init-calabash.sh b/scripts/include/init-calabash.sh new file mode 100644 index 00000000..460c9427 --- /dev/null +++ b/scripts/include/init-calabash.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +init_calabash() { + local my_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd) +# source "${my_dir}/common-environment.sh" + source "${my_dir}/init-saxon.sh" + + if [[ -z "$CALABASH_HOME" ]]; then + echo -e "${P_ERROR}CALABASH_HOME is not set or is empty.${P_END} ${P_INFO}Please set CALABASH_HOME to point to the location of the Calabash XML installation.${P_END}" + fi +} + +run_calabash() { + local xproc="$1"; shift + local extra_params=($@) + + local JARS=() + JARS+=("$CALABASH_HOME"/*.jar) + JARS+=("$CALABASH_HOME"/lib/*.jar) + + local classpath=$(IFS=:; echo -e "${JARS[*]}") + + java -cp "$classpath" com.xmlcalabash.drivers.Main -D "${extra_params[@]}" "$xproc" + + if [ "$?" -ne 0 ]; then + echo -e "${P_ERROR}Error running Calabash.${P_END}" + return 3 + fi + return 0 +} diff --git a/scripts/include/init-saxon.sh b/scripts/include/init-saxon.sh index 67dc1c74..e4a683f3 100644 --- a/scripts/include/init-saxon.sh +++ b/scripts/include/init-saxon.sh @@ -36,11 +36,14 @@ xsl_transform() { set -- "$@" "-s:${source_file}" fi - java -cp "$classpath" net.sf.saxon.Transform "$@" "${extra_params[@]}" - - if [ "$?" -ne 0 ]; then + result=$(java -cp "$classpath" net.sf.saxon.Transform "$@" "${extra_params[@]}" 2>&1) + cmd_exitcode=$? + if [ $cmd_exitcode -ne 0 ]; then + echo -e "${P_ERROR}${result}${P_END}" echo -e "${P_ERROR}Error running Saxon.${P_END}" - return 3 + return 3; + else + echo -e "${result}" fi return 0 } diff --git a/support/oxygen/frameworks/metaschema/metaschema.framework b/support/oxygen/frameworks/metaschema/metaschema.framework new file mode 100644 index 00000000..bb9d5a1e --- /dev/null +++ b/support/oxygen/frameworks/metaschema/metaschema.framework @@ -0,0 +1,908 @@ + + + + + document.types + + + + + + + + + + Metaschema + + + + + 2 + + + ${framework}/../../../../toolchains/xslt-M4/validate/metaschema.xsd + + + + + + + + + + + + + + + + false + + + false + + + + + + + + Menu + + + + + + + + + + + + + + + + + + + Contextual menu + + + + + + + + + + + + + + + + + + + Toolbar + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://csrc.nist.gov/ns/oscal/metaschema/1.0 + + + METASCHEMA + + + * + + + * + + + + + + * + + + * + + + * + + + + + + + + + + + + + + + build.xml + + + + + + catalog + + + The path to catalog files that will be used for all XSLTs involved in the XSpec execution. Separated by semicolons (;). + + + ${xmlCatalogFilesList} + + + + + + 5 + + + + + + + + + + + catalog.is.uri + + + + + + true + + + + + + 5 + + + + + + + + + + + clean.output.dir + + + Cleans up all the intermediate files created by the unit process. Set in to false if you want to inspect these files. + + + true + + + + + + 5 + + + + + + + + + + + test.type + + + + + + ${xpath_eval(((doc('${currentFileURL}')!*:description!(@query,@schematron)!substring(name(),1,1)),'t')[1])} + + + + + + 5 + + + + + + + + + + + xspec.fail + + + + + + false + + + + + + 5 + + + + + + + + + + + xspec.project.dir + + + + + + ${frameworkDir}/../../../../support/xspec + + + + + + 5 + + + + + + + + + + + xspec.result.html + + + The file path where the test result HTML will be created. + + + ${cfd}/${cfn}-result.html + + + + + + 5 + + + + + + + + + + + xspec.xml + + + + + + ${cf} + + + + + + 5 + + + + + + + + + + + saxon.custom.options + + + + + + + + + + + + 5 + + + + + + + + + + + + -Xmx256m + + + false + + + + + + false + + + + + + ${frameworkDir}/../../../../support/xspec + + + false + + + + + + Run XSpec v2.1 Test + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + ANT + + + true + + + true + + + + + + true + + + ${cfd}/${cfn}-result.html + + + false + + + false + + + false + + + false + + + false + + + false + + + + + + + + + ANT + + + + ${oxygenHome}/classes + ${oxygenHome}/lib/oxygenCommons.jar + ${oxygenHome}/lib/oxygen.jar + ${oxygenHome}/lib/oxygenDeveloper.jar + ${oxygenHome}/lib/oxygenEclipse.jar + ${oxygenHome}/lib/oxygenDeveloperEclipse.jar + ${oxygenHome}/lib/oxygen-sandbox.jar + ${oxygenHome}/lib/oxygen-license.jar + ${oxygenHome}/lib/oxygen-basic-utilities.jar + ${oxygenHome}/lib/oxygen-editor-variables-parser.jar + ${oxygenHome}/lib/xml-apis.jar + ${oxygenHome}/lib/*resolver*.jar + ${oxygenHome}/lib/*saxon*9*.jar + ${oxygenHome}/lib/*log4j*.jar + ${oxygenHome}/lib/*xerces*.jar + ${oxygenHome}/lib/guava-*.jar + + + + + + + + + + ${currentFileURL} + + + + source + + + + + + + + + + + + true + + + _0_main-module + + + + + + + + true + + + _1_collected + + + + + + + + true + + + _2_refs-built + + + + + + + + true + + + _3_extra-modules-trimmed + + + + + + + + true + + + _4_defs-pruned + + + + + + + + true + + + _5_using-names-added + + + + + + + + true + + + _6_sibling-names-added + + + + + + + + true + + + _7_digested + + + + + + + + true + + + final + + + + + + + + + + + + * + + + + + + + + + + + + Metaschema Compose + + + + + + + + + + + + + + + + + + ${framework}/../../../../toolchains/xslt-M4/compose/metaschema-compose.xpl + + + + + + false + + + false + + + XPROC + + + false + + + false + + + + + + false + + + + + + false + + + false + + + true + + + false + + + false + + + false + + + + + + + + + Add-on for Calabash XProc Engine + + + + + + + + + + + + + + + + + text/xml + + + + + ${currentFileURL} + + + + + <Default engine> + + + true + + + + + true + + + + + + + + + + + + + + 2 + + + ${framework}/../../../../toolchains/xslt-M4/validate/metaschema.xsd + + + + + + + + + text/xml + + + + + ${currentFileURL} + + + + + <Default engine> + + + true + + + + + true + + + + + + + + + + + + + + 7 + + + ${framework}/../../../../toolchains/xslt-M4/validate/metaschema-composition-check.sch + + + + + + + + Validation_scenario + + + Validate Metaschema + + + + + + + Validate Metaschema + + + + + Metaschema Compose + + + + + + + false + + + Text + + + + + + + + + + + + + + + + + + + + + + + + 3 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/support/xspec b/support/xspec new file mode 160000 index 00000000..d8bbeca5 --- /dev/null +++ b/support/xspec @@ -0,0 +1 @@ +Subproject commit d8bbeca51eaccc8b3e07c82547f6aff4a2072aef diff --git a/test-suite/docs-models/models_metaschema.xml b/test-suite/docs-models/models_metaschema.xml index 58169d15..fff9075b 100644 --- a/test-suite/docs-models/models_metaschema.xml +++ b/test-suite/docs-models/models_metaschema.xml @@ -1,6 +1,6 @@ - + @@ -8,7 +8,8 @@ 1.0 test-model http://csrc.nist.gov/metaschema/ns/everything - + http://csrc.nist.gov/metaschema/ns/everything +

A mini metaschema produced for documentation testing purposes.

This metaschema exercises modeling with a mix of global, modular (local) and inline @@ -37,6 +38,9 @@ EVERYTHING + + deep1 + overloaded1 @@ -65,7 +69,7 @@ - + @@ -94,6 +98,36 @@ + + Deep branch + A deepish branching structure defined globally. + + + Deep two (inline) + Two levels in. + + + Deep Three (inline) + Three levels in. + + + Count + A count in natural language. + + + + + + + + + One + Two + Three + + + + Overloaded field A field called several times by different names. diff --git a/test-suite/metaschema-xspec/included_metaschema.xml b/test-suite/metaschema-xspec/included_metaschema.xml new file mode 100644 index 00000000..adac6640 --- /dev/null +++ b/test-suite/metaschema-xspec/included_metaschema.xml @@ -0,0 +1,36 @@ + + + + +Included Metaschema + 1.0 + included + http://csrc.nist.gov/ns/oscal/1.0 + + + Assembly that includes global and local flags + This assembly includes a flag defined in this included metaschema module. + + +

This reference should be to the globally scoped flag in the included metaschema.

+
+ + + +

This reference should be to the locally scoped flag in the included metaschema.

+
+
+ + + + Global Flag - Included Metaschema + A flag from the included metaschema. It's scope is global. This name will clash with names in the importing metaschema. + + + + Local Flag - Included Metaschema + A flag from the included metaschema. It's scope is local. This name does not clash. + +
\ No newline at end of file diff --git a/test-suite/metaschema-xspec/including_metaschema.xml b/test-suite/metaschema-xspec/including_metaschema.xml new file mode 100644 index 00000000..c5c45909 --- /dev/null +++ b/test-suite/metaschema-xspec/including_metaschema.xml @@ -0,0 +1,46 @@ + + + + +Including Metaschema + 1.0 + including + http://csrc.nist.gov/ns/oscal/1.0 + + + + + Assembly that includes global and local flags + This assembly includes a flag defined in this including and the included metaschema module. + including-flags + + +

This reference should be to the globally scoped flag in the including metaschema. This definition is taking precedence over the other definition included (with the same name).

+
+
+ + +

This reference should be to the locally scoped flag in the including metaschema.

+
+
+ + + +

This is the included "included-flags" assembly.

+
+
+
+
+ + + Global Flag - Including Metaschema + A flag from the including metaschema. It's scope is global. This should be marked as a name clash. + + + + Local Flag - Including Metaschema + A flag from the including metaschema. It's scope is local. This name does not clash. + +
\ No newline at end of file diff --git a/test-suite/metaschema-xspec/metaschema-basic-schematron-result.html b/test-suite/metaschema-xspec/metaschema-basic-schematron-result.html new file mode 100644 index 00000000..357888f4 --- /dev/null +++ b/test-suite/metaschema-xspec/metaschema-basic-schematron-result.html @@ -0,0 +1,679 @@ + + + + Test Report for C:/Users/davidwal/git/github/david-waltermire-nist/OSCAL/build/metaschema/toolchains/xslt-M4/validate/metaschema-simple-check.sch (passed: 2 / pending: 0 / failed: 0 / total: 2) + + + +

Test Report

+

Schematron: C:/Users/davidwal/git/github/david-waltermire-nist/OSCAL/build/metaschema/toolchains/xslt-M4/validate/metaschema-simple-check.sch

+

XSpec: C:/Users/davidwal/git/github/david-waltermire-nist/OSCAL/build/metaschema/test-suite/metaschema-xspec/metaschema-basic-schematron.xspec

+

Tested: 29 April 2021 at 09:08

+

Contents

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
passed: 2pending: 0failed: 0total: 2
poc-on-remote-file1001
poc-locally1001
+
+

poc-on-remote-filepassed: 1 / pending: 0 / failed: 0 / total: 1

+ + + + + + + + + + + + + + + + + + + +
poc-on-remote-filepassed: 1 / pending: 0 / failed: 0 / total: 1
An example of a pre-publication QA steppassed: 1 / pending: 0 / failed: 0 / total: 1
The string does not start with 'oscal-', which we really want assert shortname-format-says-oscal + /m:METASCHEMA/m:short-nameSuccess
+
+
+

poc-locallypassed: 1 / pending: 0 / failed: 0 / total: 1

+ + + + + + + + + + + + + + + + + + + +
poc-locallypassed: 1 / pending: 0 / failed: 0 / total: 1
An example of a pre-publication QA steppassed: 1 / pending: 0 / failed: 0 / total: 1
The string does not start with 'oscal-', which we really want assert shortname-format-says-oscalSuccess
+
+ + \ No newline at end of file diff --git a/test-suite/metaschema-xspec/metaschema-basic-schematron.xspec b/test-suite/metaschema-xspec/metaschema-basic-schematron.xspec new file mode 100644 index 00000000..407645e4 --- /dev/null +++ b/test-suite/metaschema-xspec/metaschema-basic-schematron.xspec @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + boohoo + + + + + + + + + + + + diff --git a/test-suite/metaschema-xspec/metaschema-composition-schematron-result.html b/test-suite/metaschema-xspec/metaschema-composition-schematron-result.html new file mode 100644 index 00000000..7c94aafb --- /dev/null +++ b/test-suite/metaschema-xspec/metaschema-composition-schematron-result.html @@ -0,0 +1,643 @@ + + + + Test Report for C:/Users/wap1/Documents/usnistgov/OSCAL/build/metaschema/toolchains/xslt-M4/validate/metaschema-composition-check.sch (passed: 1 / pending: 0 / failed: 0 / total: 1) + + + +

Test Report

+

Schematron: C:/Users/wap1/Documents/usnistgov/OSCAL/build/metaschema/toolchains/xslt-M4/validate/metaschema-composition-check.sch

+

XSpec: C:/Users/wap1/Documents/usnistgov/OSCAL/build/metaschema/test-suite/metaschema-xspec/metaschema-composition-schematron.xspec

+

Tested: 28 April 2021 at 17:02

+

Contents

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
passed: 1pending: 0failed: 0total: 1
poc-on-remote-file1001
+
+

poc-on-remote-filepassed: 1 / pending: 0 / failed: 0 / total: 1

+ + + + + + + + + + + + + + + + + + + +
poc-on-remote-filepassed: 1 / pending: 0 / failed: 0 / total: 1
Seeing any name clashespassed: 1 / pending: 0 / failed: 0 / total: 1
No name clash found not assert detect-xml-sibling-name-clashSuccess
+
+ + \ No newline at end of file diff --git a/test-suite/metaschema-xspec/metaschema-composition-schematron.xspec b/test-suite/metaschema-xspec/metaschema-composition-schematron.xspec new file mode 100644 index 00000000..603d88e4 --- /dev/null +++ b/test-suite/metaschema-xspec/metaschema-composition-schematron.xspec @@ -0,0 +1,28 @@ + + + + true + + + + + + + + + + + + + + diff --git a/toolchains/xslt-M4/compose/testing/problem01-module_metaschema.xml b/test-suite/metaschema-xspec/problem01-module_metaschema.xml similarity index 100% rename from toolchains/xslt-M4/compose/testing/problem01-module_metaschema.xml rename to test-suite/metaschema-xspec/problem01-module_metaschema.xml diff --git a/toolchains/xslt-M4/compose/testing/problem01_metaschema.xml b/test-suite/metaschema-xspec/problem01_metaschema.xml similarity index 76% rename from toolchains/xslt-M4/compose/testing/problem01_metaschema.xml rename to test-suite/metaschema-xspec/problem01_metaschema.xml index 34e29c80..adfa8091 100644 --- a/toolchains/xslt-M4/compose/testing/problem01_metaschema.xml +++ b/test-suite/metaschema-xspec/problem01_metaschema.xml @@ -1,10 +1,6 @@ - - - - + + OSCAL TEST Format 0.0 oscal-test @@ -26,7 +22,13 @@ + + replicate-duplicate-global-field + + + Another field with a misleading name. + Locally defined field XXX @@ -48,5 +50,5 @@ Flag, defined at top level XXX - + diff --git a/test-suite/metaschema-xspec/scope-local-imported_metaschema.xml b/test-suite/metaschema-xspec/scope-local-imported_metaschema.xml new file mode 100644 index 00000000..5b07c66b --- /dev/null +++ b/test-suite/metaschema-xspec/scope-local-imported_metaschema.xml @@ -0,0 +1,26 @@ + + + + + Imported Metaschema + 1.0 + imported + http://csrc.nist.gov/ns/oscal/1.0 + + + Assembly that includes global and local flags + This assembly references a global flag that is shadowed by a global flag defined in the importing metaschema. + + +

This reference should be to the locally scoped flag "local-flag" from the imported metaschema.

+
+
+
+ + + Local Flag - Imported Metaschema + A locally scoped flag from the imported metaschema. + +
\ No newline at end of file diff --git a/test-suite/metaschema-xspec/scope-local-importing_metaschema.xml b/test-suite/metaschema-xspec/scope-local-importing_metaschema.xml new file mode 100644 index 00000000..3c5c93cf --- /dev/null +++ b/test-suite/metaschema-xspec/scope-local-importing_metaschema.xml @@ -0,0 +1,31 @@ + + + + + Importing Metaschema + 1.0 + importing + http://csrc.nist.gov/ns/oscal/1.0 + + + + + Assembly that global flags + This assembly references a global flag that shadows a global flag defined in an imported metaschema. + importing-flags + + +

This broken reference is to a locally scoped flag in the imported metaschema. An error should be generated that indicates this.

+
+
+ + + +

This is the imported "imported-flags" assembly.

+
+
+
+
+
\ No newline at end of file diff --git a/toolchains/xslt-M4/compose/annotate-composition.xsl b/toolchains/xslt-M4/compose/annotate-composition.xsl new file mode 100644 index 00000000..23574a82 --- /dev/null +++ b/toolchains/xslt-M4/compose/annotate-composition.xsl @@ -0,0 +1,84 @@ + + + + + + + + + + + + + / + + + + + + + + + + + + + + + + /{ replace(name(),'^define\-','') }/{ @module }/{@name} + + + + + + + + + + + + + + + + + + + + + + + {$sofar-xml}/{$xml-name} + {$sofar-json}/{$json-name} + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/annotate-model-map.xsl b/toolchains/xslt-M4/compose/annotate-model-map.xsl new file mode 100644 index 00000000..2cfa5cdf --- /dev/null +++ b/toolchains/xslt-M4/compose/annotate-model-map.xsl @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /{ @key } + + + + /@{ . } + + + + /{ . } + + + + + + + + + /{ . } + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/make-model-map.xsl b/toolchains/xslt-M4/compose/make-model-map.xsl index 83c8a2cb..fc4f3ebd 100644 --- a/toolchains/xslt-M4/compose/make-model-map.xsl +++ b/toolchains/xslt-M4/compose/make-model-map.xsl @@ -9,47 +9,60 @@ exclude-result-prefixes="#all" version="3.0"> + - + + + - - - + + + - - - - - - - - + + + + + + + + + + + + + empty - + true - - + + + + + + - + @@ -61,47 +74,67 @@ - - - - + + - + + - + - + + + + + + + - + + - - - - - + + + + + + + + + + + + global - + + - - - - - + + + + - + + + + + in-use + + + @@ -131,6 +164,24 @@ + + + + + + + + + + + + + + + + + + - + + - + @@ -186,23 +241,31 @@ + - - + + + + - - + + - - + + - - - + + + + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-build-refs.xsl b/toolchains/xslt-M4/compose/metaschema-build-refs.xsl new file mode 100644 index 00000000..5811072e --- /dev/null +++ b/toolchains/xslt-M4/compose/metaschema-build-refs.xsl @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + The metaschema short-name '{ short-name }' is the same as the short-name of imported { if (count($clashing-modules)=1) then 'module' else 'modules'} '{ ($clashing-modules/@_base-uri => string-join(', ')) }'. Each module's short-name must be unique. + + + + + + + + + + + Assembly definition '{ @name }' in module '{ @module }' shadows { if (count($shadows) eq 1) then 'this definition' else 'these definitions'}: { ($shadows ! ('''' || @name || ''' in module ''' || @module || '''') ) => string-join('; ') } + + + + + + + + + + + Field definition '{ @name }' in module '{ @module }' shadows { if (count($shadows) eq 1) then 'this definition' else 'these definitions'}: { ($shadows ! ('''' || @name || ''' in module ''' || @module || '''') ) => string-join('; ') } + + + + + + + + + + + + Flag definition '{ @name }' in module '{ @module }' shadows { if (count($shadows) eq 1) then 'the definition' else 'these definitions:'} { ($shadows ! ('''' || @name || ''' in module ''' || @module || '''') ) => string-join('; ') }. + + + + + + + + + + + + + + + + + Target definition not found for assembly reference '{ $me }'. + + + + + + + + + + + + + + Target definition not found for field reference '{ $me }'. + + + + + + + + + + + + + + Target definition not found for flag reference '{ $me }'. + + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-collect.xsl b/toolchains/xslt-M4/compose/metaschema-collect.xsl index e8d5bb9c..9391dad1 100644 --- a/toolchains/xslt-M4/compose/metaschema-collect.xsl +++ b/toolchains/xslt-M4/compose/metaschema-collect.xsl @@ -12,9 +12,27 @@ + + + + no + 1 + 0 + no + SINGLETON_OR_ARRAY + UNGROUPED + WITH_WRAPPER + no + string + global + - + + + No Metaschema found in namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0' : instead we have a document '{ */name() }' in namespace '{ /*/namespace-uri(.) }' + + @@ -22,10 +40,23 @@ + --> @@ -33,81 +64,106 @@ + - - + + + - - - Warning: circular import of { $uri } skipped - - - Error: No metaschema module is found at { $uri } - Warning: circular import of { $uri } skipped - - - - - - - + + + + + Circular import of { $uri } in this file (or one of its children) skipped. + + + + + + Error: No metaschema module is found at { $uri }. + + + + + + Error: No metaschema module is found at { $uri } (it is not named METASCHEMA in namespace 'http://csrc.nist.gov/ns/oscal/metaschema/1.0'). + + + + + + + + - - - - - { ../short-name }-{ @name } - - - - { @name } - - - + + + + + + + + + - - + + + + - - + + + + - - + + - - + + + - - + + + + + + + + + + + { ../short-name } + { base-uri(.) } + + { ../short-name }:{ @name } + + - + + + + - { ancestor::METASCHEMA[1]/short-name }-{ @ref } - - { @ref } - diff --git a/toolchains/xslt-M4/compose/metaschema-compose-debug.xpl b/toolchains/xslt-M4/compose/metaschema-compose-debug.xpl deleted file mode 100644 index 50e9628b..00000000 --- a/toolchains/xslt-M4/compose/metaschema-compose-debug.xpl +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No longer filtering definitions reachable from nominal root - - - - - - - - - - - - - - \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-compose.xpl b/toolchains/xslt-M4/compose/metaschema-compose.xpl new file mode 100644 index 00000000..c65e781e --- /dev/null +++ b/toolchains/xslt-M4/compose/metaschema-compose.xpl @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-digest.xsl b/toolchains/xslt-M4/compose/metaschema-digest.xsl index a9f09f79..0d1c0121 100644 --- a/toolchains/xslt-M4/compose/metaschema-digest.xsl +++ b/toolchains/xslt-M4/compose/metaschema-digest.xsl @@ -17,9 +17,9 @@ - - - + + + @@ -41,11 +41,15 @@ - - + + + + + + + - @@ -65,7 +69,7 @@ - + @@ -74,15 +78,12 @@ - + - - - - + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-prune-unused-definitions.xsl b/toolchains/xslt-M4/compose/metaschema-prune-unused-definitions.xsl new file mode 100644 index 00000000..deea38a2 --- /dev/null +++ b/toolchains/xslt-M4/compose/metaschema-prune-unused-definitions.xsl @@ -0,0 +1,118 @@ + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No root found in this metaschema composition. + + + { . } = { $reference-counts(.) } + + + + + + + + + + + + + + + unused-definition + REMOVING unused assembly definition for '{ @name }' from { ancestor::METASCHEMA[1]/@module + } + + + + + + + unused-definition + REMOVING unused field definition for '{ @name }' from { ancestor::METASCHEMA[1]/@module + } + + + + + + + unused-definition + REMOVING unused flag definition for '{ @name }' from { ancestor::METASCHEMA[1]/@module + } + + + + + + warning + + + + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-reduce1.xsl b/toolchains/xslt-M4/compose/metaschema-reduce1.xsl deleted file mode 100644 index 009414f8..00000000 --- a/toolchains/xslt-M4/compose/metaschema-reduce1.xsl +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - no - - - - - - - - - - - - - - - - - - - - - - - - - - - - KEEPING definition for '{ @name }' field from { ancestor::METASCHEMA[1]/@module }: last given - - - - - - - KEEPING definition for '{ @name }' flag from { ancestor::METASCHEMA[1]/@module }: last given - - - - - - - KEEPING definition for '{ @name }' assembly from { ancestor::METASCHEMA[1]/@module }: last given - - - - - - - REMOVING superseded definition for '{ @name }' { - replace(local-name(),'^define-','')} from { ancestor::METASCHEMA[1]/@module - } - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-reduce2.xsl b/toolchains/xslt-M4/compose/metaschema-reduce2.xsl deleted file mode 100644 index 8a884606..00000000 --- a/toolchains/xslt-M4/compose/metaschema-reduce2.xsl +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - no - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Assembly references: { $assembly-references } - - Field references: { $field-references } - - Flag references: { $flag-references } - - - - - - - - - - REMOVING unused assembly definition for '{ @name }' from { ancestor::METASCHEMA[1]/@module - } - - - - - - REMOVING unused field definition for '{ @name }' from { ancestor::METASCHEMA[1]/@module - } - - - - - - REMOVING unused flag definition for '{ @name }' from { ancestor::METASCHEMA[1]/@module - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-resolve-sibling-names.xsl b/toolchains/xslt-M4/compose/metaschema-resolve-sibling-names.xsl new file mode 100644 index 00000000..5f5d590c --- /dev/null +++ b/toolchains/xslt-M4/compose/metaschema-resolve-sibling-names.xsl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + { @_using-name } + { (group-as/@name,@_using-name)[1] } + + + + + + + + { group-as/@name } + { group-as/@name } + + + + + + + + p ul ol pre table h1 h2 h3 h4 h5 h6 + { @_using-name } + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-resolve-use-names.xsl b/toolchains/xslt-M4/compose/metaschema-resolve-use-names.xsl new file mode 100644 index 00000000..ab6f4653 --- /dev/null +++ b/toolchains/xslt-M4/compose/metaschema-resolve-use-names.xsl @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/metaschema-trim-extra-modules.xsl b/toolchains/xslt-M4/compose/metaschema-trim-extra-modules.xsl new file mode 100644 index 00000000..13985b9d --- /dev/null +++ b/toolchains/xslt-M4/compose/metaschema-trim-extra-modules.xsl @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/compose/reduce-map.xsl b/toolchains/xslt-M4/compose/reduce-map.xsl index 8d64730d..803070a6 100644 --- a/toolchains/xslt-M4/compose/reduce-map.xsl +++ b/toolchains/xslt-M4/compose/reduce-map.xsl @@ -11,7 +11,9 @@ - + + + @@ -25,9 +27,9 @@ - + diff --git a/toolchains/xslt-M4/compose/testing/1_collected/collect-report.html b/toolchains/xslt-M4/compose/testing/1_collected/collect-report.html index d7949ae2..87930dcc 100644 --- a/toolchains/xslt-M4/compose/testing/1_collected/collect-report.html +++ b/toolchains/xslt-M4/compose/testing/1_collected/collect-report.html @@ -1,30 +1,649 @@ - + -
+

Working metaschema Run

-

Modules collected, no loops Show

+

Modules collected, no loops Show Q-Diff Diff

+ +
-
+

Metaschema skeleton Run

-

Modules collected, no loops Show

+

Modules collected, no loops Show Q-Diff Diff

+ +
-
+

Nested locals Run

-
-

Local definitions all expanded Show

-
-
-
-

Nested locals Run

-
-

Local definitions all expanded with grouping Show

+
+

Local definitions preserved with amended names Show Q-Diff Diff

+ +
diff --git a/toolchains/xslt-M4/compose/testing/1_collected/collect-result.html b/toolchains/xslt-M4/compose/testing/1_collected/collect-result.html index e97cfff6..4a31d014 100644 --- a/toolchains/xslt-M4/compose/testing/1_collected/collect-result.html +++ b/toolchains/xslt-M4/compose/testing/1_collected/collect-result.html @@ -1,7 +1,7 @@ - Test Report for C:/Users/wap1/Documents/usnistgov/metaschema/toolchains/xslt-M4/compose/metaschema-collect.xsl (passed: 3 / pending: 0 / failed: 0 / total: 3) + Test Report for C:/Users/wap1/Documents/usnistgov/OSCAL/build/metaschema/toolchains/xslt-M4/compose/metaschema-collect.xsl (passed: 1 / pending: 0 / failed: 2 / total: 3) + + + + + diff --git a/toolchains/xslt-M4/document/json/json-definitions.xsl b/toolchains/xslt-M4/document/json/json-definitions.xsl new file mode 100644 index 00000000..630c3d25 --- /dev/null +++ b/toolchains/xslt-M4/document/json/json-definitions.xsl @@ -0,0 +1,133 @@ + + + + + + + + json/definitions + xml/definitions + + + + +

+ JSON Base URI + + { . } +

+
+ + +

+ JSON Schema + + oscal_{$file-map(string(.))}_schema.json +

+
+ + + +

+ XML to JSON converter + + oscal_{$file-map(string(.))}_xml-to-json-converter.xsl + + (How do I use the converter to convert OSCAL XML to JSON) +

+
+ + + json-definition + + + + + + + + + ../ + + + + + + +
+
+ Remarks + +
+
+
+
+ + +

group as { @name }

+
+ + + + + + + + + + + + + + + + + + + + + + + assembly
+ +
+ + + + + + +
+ + + (global definition) + +
+ + + + for + { . } + + + +
\ No newline at end of file diff --git a/toolchains/xslt-M4/document/json/json-docs-hugo-uswds.xsl b/toolchains/xslt-M4/document/json/json-docs-hugo-uswds.xsl index 24b45041..82e12213 100644 --- a/toolchains/xslt-M4/document/json/json-docs-hugo-uswds.xsl +++ b/toolchains/xslt-M4/document/json/json-docs-hugo-uswds.xsl @@ -9,19 +9,6 @@ - - - - @@ -39,7 +26,6 @@ - @@ -50,6 +36,9 @@ + ../../xml/definitions + + @@ -155,8 +144,12 @@

- - + + + + + + + -->
-

+ + + , @@ -193,7 +190,7 @@ -

+

formal name @@ -218,11 +215,11 @@ - + @@ -282,19 +279,18 @@ - - - -

- + + + + -
+
@@ -303,18 +299,18 @@ , and - + .

-
+
-
+
@@ -337,12 +333,12 @@
-

+

Property Properties -

+

    @@ -359,18 +355,18 @@ -
+
-
+
-
{ . } is a root (containing) object for this - schema.
+

{ . } is a root (containing) object for thi + schema.

@@ -378,8 +374,8 @@ model/(.|choice)/( define-field | define-assembly | field | assembly )"/>
-

{ if (count(current-group()) eq 1) then 'Property' else - 'Properties' } ({ count(current-group()) })

+

{ if (count(current-group()) eq 1) then 'Property' else + 'Properties' } ({ count(current-group()) })

    @@ -390,7 +386,7 @@ -
+
@@ -432,7 +428,7 @@ select="current-group()/ancestor::*[self::define-field | self::define-assembly][1]"> , and - + .

@@ -501,13 +497,10 @@ -
-

+

-

+

@@ -546,28 +539,16 @@ - + NO DEFINITION FOUND FOR { local-name() }
- - - modeling usename{ ' toc2'[not($grouped or - $too-deep)] } - - - +

- +

  @@ -639,21 +620,9 @@ -->
- - - modeling { ' usename'[not($grouped)] - }{ ' toc2'[not($grouped or $too-deep)] } - - - +

- +

@@ -699,7 +668,7 @@ model/(.|choice)/( define-field | define-assembly | field | assembly )"/>
-
+
{ if (count(current-group()) eq 1) then 'Property' else 'Properties' } ({ count(current-group()) }): @@ -741,7 +710,8 @@ @@ -1059,13 +1029,13 @@
-

+

-

+

@@ -1225,7 +1195,8 @@ - object (globally defined) + + object (globally defined) diff --git a/toolchains/xslt-M4/document/json/notation-spec.html b/toolchains/xslt-M4/document/json/notation-spec.html new file mode 100644 index 00000000..a50fdd6b --- /dev/null +++ b/toolchains/xslt-M4/document/json/notation-spec.html @@ -0,0 +1,136 @@ + + + + notation model + + +
+

Fully expanded (new approach)

+
    +
  • Catalog
      +
    • Metadata
        +
      • title
      • +
      • published
      • +
      • ...
      • +
    • +
  • +
  • Profile
      +
    • Metadata
        +
      • title
      • +
      • published
      • +
      • ...
      • +
    • +
  • +
  • Index (parent context)
      +
    • Metadata
        +
      • Catalog (link to Metadata under Catalog)
      • +
      • Profile (link to Metadata under Profile)
      • +
    • +
    • Title
        +
      • Catalog / Metadata
      • +
      • Profile / Metadata
      • +
    • +
  • +
+
+

doc references

+
    +
  1. +

    Reference to a specific node in a model format.

    +

    In JSON/YAML: + /documentation/v{major}/json/reference#/{property/item}/{property/item}/..

    +

    In XML: /documentation/v{major}/json/reference#/{element/@attribute}/{element/@attribute}/..

    +

    Examples:

    +
      +
    • JSON/YAML: + /documentation/v{major}/json/reference#/catalog/metadata/props/name
    • +
    • XML(attribute): /documentation/v{major}/xml/reference#/catalog/metadata/prop/@name
    • +
    • XML(element): /documentation/v{major}/xml/reference#/catalog/metadata/prop
    • +
    +
  2. +
  3. +

    Reference to all occurrences of a name in a format

    +

    JSON/YAML: /documentation/v{major}/json/index#/index/{property/item}

    +

    XML: /documentation/v{major}/xml/index#/index/{element/@attribute}

    +

    Examples:

    +
      +
    • JSON/YAML: /documentation/v{major}/json/index#/index/props
    • +
    • XML(attribute): /documentation/v{major}/xml/index#/index/@name
    • +
    • XML(element): /documentation/v{major}/xml/index#/index/prop
    • +
    +
  4. +
  5. +

    Reference to a type definition

    +
  6. +
+
+
+

document naming

+

{version} = v{major}.{minor}, v{major}, or latest

+
    +
  1. +

    model maps

    +

    /documentation/{version}/xml/outline

    +

    /documentation/{version}/json/outline

    +
  2. +
  3. +

    reference

    +

    /documentation/v{major}.{minor}/xml/reference

    +

    /documentation/v{major}.{minor}/json/reference

    +
  4. +
  5. +

    index

    +

    /documentation/v{major}.{minor}/xml/index

    +

    /documentation/v{major}.{minor}/json/index

    +
  6. +
  7. +

    type definitions

    +

    /documentation/v{major}.{minor}/xml/definitions#/{type name}/{path}

    +

    /documentation/v{major}.{minor}/json/definitions#/{type name}/{path}

    +
  8. +
+
+
+ + \ No newline at end of file diff --git a/toolchains/xslt-M4/document/json/object-index-html.xsl b/toolchains/xslt-M4/document/json/object-index-html.xsl new file mode 100644 index 00000000..726ba8b5 --- /dev/null +++ b/toolchains/xslt-M4/document/json/object-index-html.xsl @@ -0,0 +1,75 @@ + + + + + + + + json/index + json/reference + json/definitions + + + + ../ + + + + + + + +
+ + +
+

{ current-grouping-key() }

+
    + +
+
+
+
+
+ + +
  • + + + + - + + + + Missing link? + + + + + +
  • +
    + + { @name } + + { formal-name } + + { */formal-name } + + + + + + + + / + { string(.) } + + +
    diff --git a/toolchains/xslt-M4/document/json/object-map-html.xsl b/toolchains/xslt-M4/document/json/object-map-html.xsl index f95540e3..1832dc28 100644 --- a/toolchains/xslt-M4/document/json/object-map-html.xsl +++ b/toolchains/xslt-M4/document/json/object-map-html.xsl @@ -5,12 +5,19 @@ xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0" exclude-result-prefixes="#all"> - oscal-catalog-xml - - - + + + + + + + + ../ + + + ../../../datatypes @@ -26,8 +33,10 @@ -
    - +
    +
    + +
    @@ -60,7 +69,9 @@ details:not([open]) .show-closed { display: inline } - + + + @@ -70,7 +81,7 @@ details:not([open]) .show-closed { display: inline } --> - + : @@ -98,7 +109,7 @@ details:not([open]) .show-closed { display: inline } --> - + : @@ -112,7 +123,6 @@ details:not([open]) .show-closed { display: inline }
    -

    @@ -120,7 +130,6 @@ details:not([open]) .show-closed { display: inline } ,

    -
    @@ -131,7 +140,7 @@ details:not([open]) .show-closed { display: inline }

    - + @@ -159,7 +168,7 @@ details:not([open]) .show-closed { display: inline } --> - + : @@ -183,35 +192,38 @@ details:not([open]) .show-closed { display: inline }

    - - - - - - - + + - + An array of - + { local-name() }{ if (@max-occurs != '1') then 's' else '' } - + Array members, or a singleton - - - + { local-name() } - + + + not seeing json tree id for { name(.) } + + + + + + + + { local-name()}s @@ -269,11 +281,12 @@ details:not([open]) .show-closed { display: inline } { @as-type } - -
    - -
    + +
    + +
    +
    diff --git a/toolchains/xslt-M4/document/json/object-reference-html.xsl b/toolchains/xslt-M4/document/json/object-reference-html.xsl new file mode 100644 index 00000000..aca031f1 --- /dev/null +++ b/toolchains/xslt-M4/document/json/object-reference-html.xsl @@ -0,0 +1,195 @@ + + + + + + json/reference + xml/reference + json/outline + json/definitions + + ../../../datatypes + + + + +

    + JSON Schema + + oscal_{$file-map(string(.))}_schema.json +

    +
    + + +

    + XML to JSON converter + + oscal_{$file-map(string(.))}_xml-to-json-converter.xsl (How do I use the converter to convert OSCAL XML to JSON?) +

    +
    + + + + +
    +
    + Remarks + +
    +
    +
    +
    + + + + + ../ + + + + + + + + + + + + +
    + +
    +
    + + + + + + + + +
    + { if (exists(parent::map)) then 'definition' else 'instance' }-header +
    + + + + toc{ $level} name + { @key } + +

    + +

    + +

    + +

    +
    + + +
    + + + +
    + + + + + + + + + +
    + + { if ( count($my-constraints) gt 1) then 'Constraints' else 'Constraint' } ({ count($my-constraints) }) + + +
    +
    + +
    + + { if (count($mine) gt 1) then 'Properties' else 'Property' } ({ count( $mine )}) + + +
    +
    + +
    +
    +
    +
    + + + + +
    +

    (array member)

    +

    + +

    +

    + +

    + +
    +
    + + +
    +

    (array member or singleton)

    +

    + +

    +

    + +

    + +
    + + + +
    + + + + +
    + + + (global definition) + +
    + + + { @as-type } + + + + + for + { . } + + + + + + + + + + +
    diff --git a/toolchains/xslt-M4/document/json/object-tree.xsl b/toolchains/xslt-M4/document/json/object-tree.xsl index 77f6c1b0..564b9a4d 100644 --- a/toolchains/xslt-M4/document/json/object-tree.xsl +++ b/toolchains/xslt-M4/document/json/object-tree.xsl @@ -2,6 +2,7 @@ - - - - + + + - - + + + - - + - - + - - - - - - + + 1 - - - - + + + - + - - + + - + - + - + - - + { } - + - + @@ -127,12 +119,11 @@ - + - - + \ No newline at end of file diff --git a/toolchains/xslt-M4/document/make-schema-reference-index-html.xsl b/toolchains/xslt-M4/document/make-schema-reference-index-html.xsl new file mode 100644 index 00000000..2e8bf51b --- /dev/null +++ b/toolchains/xslt-M4/document/make-schema-reference-index-html.xsl @@ -0,0 +1,43 @@ + + + + + + + + ../reference + + + + + + +
    +

    { current-grouping-key() }

    +
      + +
    +
    +
    +
    +
    + + + + + + +
  • { $path } - { $formal-name } + - inside { child::*[1] } +
  • +
    +
    + + +
    diff --git a/toolchains/xslt-M4/document/pipeline-diagnostic.xsl b/toolchains/xslt-M4/document/pipeline-diagnostic.xsl new file mode 100644 index 00000000..a99c4833 --- /dev/null +++ b/toolchains/xslt-M4/document/pipeline-diagnostic.xsl @@ -0,0 +1,18 @@ + + + + + + + + + + { $test1 } + { $test2 } + + + \ No newline at end of file diff --git a/toolchains/xslt-M4/document/xml/element-index-html.xsl b/toolchains/xslt-M4/document/xml/element-index-html.xsl new file mode 100644 index 00000000..13d14874 --- /dev/null +++ b/toolchains/xslt-M4/document/xml/element-index-html.xsl @@ -0,0 +1,88 @@ + + + + + + + + xml/index + xml/reference + xml/definitions + + + + ../ + + + + + + + + + + { $who/self::attribute/'@' }{ $who/@gi } + + + +
    + + + + +
    +

    { current-grouping-key() }

    +
      + +
    +
    +
    +
    +
    + + +
  • + + + + - + + + + Missing link? + + + + + +
  • +
    + + { @name } + + { formal-name } + + { */formal-name } + + + + + + + + / + @{ string(.) } + + + + / + { string(.) } + + +
    diff --git a/toolchains/xslt-M4/document/xml/element-map-html.xsl b/toolchains/xslt-M4/document/xml/element-map-html.xsl index a64d68dd..1134cb3e 100644 --- a/toolchains/xslt-M4/document/xml/element-map-html.xsl +++ b/toolchains/xslt-M4/document/xml/element-map-html.xsl @@ -8,8 +8,18 @@ - - + + + + + + ../ + + + + + ../../../datatypes + @@ -28,8 +38,10 @@ http://localhost:1313/OSCAL/documentation/schema/catalog-layer/catalog/xml-schem -
    - +
    +
    + +
    @@ -62,12 +74,15 @@ div.OM-map p { margin: 0ex } - + + + + + - - - + + @@ -76,8 +91,6 @@ div.OM-map p { margin: 0ex } - ../../../datatypes - { $type } @@ -94,7 +107,7 @@ div.OM-map p { margin: 0ex } - +

    </ @@ -114,18 +127,17 @@ div.OM-map p { margin: 0ex }

    - - + < - / + / > - + @@ -144,7 +156,7 @@ div.OM-map p { margin: 0ex } - + =" @@ -155,7 +167,7 @@ div.OM-map p { margin: 0ex } -
    +
    + + + + xml/reference + json/reference + xml/outline + xml/definitions + + ../../../datatypes + + + + +

    + XML Schema + + oscal_{$file-map(string(.))}_schema.xsd +

    +
    + + +

    + JSON to XML converter + + oscal_{$file-map(string(.))}_json-to-xml-converter.xsl (How do I use the converter to convert OSCAL JSON to XML?) +

    +
    + + + + +
    +
    + Remarks + +
    +
    +
    +
    + + + + + + + + + + ../ + + + + + +
    + +
    +
    + + + + +
    + { if (exists(parent::map)) then 'definition' else 'instance' }-header +
    + + + + toc{ $level} name + { @gi } + +

    + +

    + +

    + +

    +
    + + +
    + +
    + + + + + + +
    + + { if ( count($my-constraints) gt 1) then 'Constraints' else 'Constraint' } ({ count($my-constraints) }) + + +
    +
    + +
    + + { if (count(current-group()) gt 1) then 'Attributes' else 'Attribute' } ({ count(current-group()) }) + + +
    +
    + +
    + + { if (count(current-group()) gt 1) then 'Elements' else 'Element' } ({ count(current-group()) }) + + +
    +
    + +
    +
    +
    +
    + + + + +
    +

    Value: { if (matches(@as-type,'^[aeiou]','i')) then 'An ' else 'A '}{ @as-type }

    +
    +
    + + +
    + + + (global definition) + +
    + + + { @as-type } + + + + + + + + + + diff --git a/toolchains/xslt-M4/document/xml/element-tree.xsl b/toolchains/xslt-M4/document/xml/element-tree.xsl index 2c3077c0..b0797ff2 100644 --- a/toolchains/xslt-M4/document/xml/element-tree.xsl +++ b/toolchains/xslt-M4/document/xml/element-tree.xsl @@ -20,17 +20,18 @@ - - - - - + + - - + + + + + @@ -45,22 +46,39 @@ - + + + + - + - + + + + /@{ . } + + + + /{ . } + + + + + + - + \ No newline at end of file diff --git a/toolchains/xslt-M4/document/xml/xml-definitions.xsl b/toolchains/xslt-M4/document/xml/xml-definitions.xsl new file mode 100644 index 00000000..8a9a58b6 --- /dev/null +++ b/toolchains/xslt-M4/document/xml/xml-definitions.xsl @@ -0,0 +1,144 @@ + + + + + + xml/definitions + json/definitions + + + + + + xml-definition + + + (unwrapped) + + + + + + + (unwrapped) + + + + + + + + + +
    + { if (count(current-group()) ne 1) then 'Attributes' else 'Attribute' } ({ count(current-group()) }): + +
    + +
    +
    +
    + +
    + Elements ({ count(current-group()) }): +
    + +
    +
    +
    +
    + + + + + + + + + ../ + + + + + + + + +

    wrapper element { @name }

    +
    +
    + + + + + + + + + + + + + + + + + + + +
    +
    + Remarks + +
    +
    +
    +
    + + + + + + + + assembly
    + +
    + + + + + + +
    + + + (global definition) + +
    + + + + for + { . } + + + +
    \ No newline at end of file diff --git a/toolchains/xslt-M4/document/xml/xml-docs-hugo-uswds.xsl b/toolchains/xslt-M4/document/xml/xml-docs-hugo-uswds.xsl index d930a6bf..5e4d05ca 100644 --- a/toolchains/xslt-M4/document/xml/xml-docs-hugo-uswds.xsl +++ b/toolchains/xslt-M4/document/xml/xml-docs-hugo-uswds.xsl @@ -51,6 +51,8 @@ + ../../json/definitions + @@ -185,7 +187,9 @@
    - + +
    -

    - - + + + + { $identifier } + +

    formal name @@ -284,19 +290,17 @@ - + -

    - -
    +
    @@ -310,11 +314,11 @@ -
    +
    -
    +
    @@ -323,7 +327,7 @@ -
    +
    @@ -354,17 +358,17 @@ -
    +
    -
    { . } is a root (containing) element in this schema.
    +

    { . } is a root (containing) element in this schema.

    -

    { if (count(current-group()) eq 1) then 'Attribute' else 'Attributes' } ({ count(current-group()) })

    +

    { if (count(current-group()) eq 1) then 'Attribute' else 'Attributes' } ({ count(current-group()) })

      @@ -377,7 +381,7 @@ -
    +
    @@ -455,8 +459,8 @@
    -

    Contents (in order)

    +

    Contents (in order)

      @@ -489,12 +493,15 @@
      -