forked from usnistgov/metaschema
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial cut at XSLT to produce XML->supermodel converter XSLT see usn…
…istgov#51; also more worked examples / problem cases
- Loading branch information
1 parent
94c7c0d
commit 74a7d6d
Showing
14 changed files
with
373 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://csrc.nist.gov/ns/oscal/metaschema/1.0" xmlns:metaschema="http://csrc.nist.gov/ns/oscal/metaschema/1.0"> | ||
<xs:element name="map"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element ref="metaschema:assembly"/> | ||
</xs:sequence> | ||
<xs:attribute name="namespace" use="required" type="xs:anyURI"/> | ||
<xs:attribute name="prefix" use="required" type="xs:NCName"/> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="assembly"> | ||
<xs:complexType> | ||
<xs:choice minOccurs="0" maxOccurs="unbounded"> | ||
<xs:element ref="metaschema:assembly"/> | ||
<xs:element ref="metaschema:field"/> | ||
<xs:element ref="metaschema:flag"/> | ||
<xs:element ref="metaschema:group"/> | ||
</xs:choice> | ||
<xs:attribute name="gi" use="required" type="xs:NCName"/> | ||
<xs:attribute name="group-xml" type="xs:NCName"/> | ||
<xs:attribute name="json-key-flag" type="xs:NCName"/> | ||
<xs:attribute name="key" type="xs:NCName"/> | ||
<xs:attribute name="scope" use="required" type="xs:NCName"/> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="group"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element minOccurs="0" ref="metaschema:assembly"/> | ||
<xs:element minOccurs="0" ref="metaschema:field"/> | ||
</xs:sequence> | ||
<xs:attribute name="gi" type="xs:NCName"/> | ||
<xs:attribute name="json-key-flag" type="xs:NCName"/> | ||
<xs:attribute name="key" use="required" type="xs:NCName"/> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="flag"> | ||
<xs:complexType> | ||
<xs:attribute name="as-type" use="required" type="xs:NCName"/> | ||
<xs:attribute name="gi" use="required" type="xs:NCName"/> | ||
<xs:attribute name="key" use="required" type="xs:NCName"/> | ||
<xs:attribute name="scope" use="required" type="xs:NCName"/> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="field"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element minOccurs="0" ref="metaschema:flag"/> | ||
<xs:element ref="metaschema:value"/> | ||
</xs:sequence> | ||
<xs:attribute name="gi" use="required" type="xs:NCName"/> | ||
<xs:attribute name="group-xml" type="xs:NCName"/> | ||
<xs:attribute name="json-key-flag" type="xs:NCName"/> | ||
<xs:attribute name="key" type="xs:NCName"/> | ||
<xs:attribute name="scope" use="required" type="xs:NCName"/> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="value"> | ||
<xs:complexType mixed="true"> | ||
<xs:attribute name="as-type" use="required" type="xs:NCName"/> | ||
<xs:attribute name="key" type="xs:NCName"/> | ||
<xs:attribute name="key-flag" type="xs:NCName"/> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
test-suite/worked-examples/everything-metaschema/models-definition-map.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<map xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0" | ||
namespace="http://csrc.nist.gov/metaschema/ns/everything" | ||
prefix="http://csrc.nist.gov/metaschema/ns/everything"> | ||
<assembly scope="global" key="EVERYTHING" gi="EVERYTHING"> | ||
<flag as-type="string" scope="global" key="id" gi="id"/> | ||
<field scope="global" key="field-1only" gi="field-1only"> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
<field scope="global" key="field-base64" gi="field-base64"> | ||
<value as-type="base64Binary" key="STRVALUE"/> | ||
</field> | ||
<field scope="global" key="field-named-value" gi="field-named-value"> | ||
<flag as-type="string" scope="global" key="id" gi="id"/> | ||
<value as-type="string" key="CUSTOM-VALUE-KEY"/> | ||
</field> | ||
<group key="groupable-fields" gi="groupable-fields"> | ||
<field scope="global" gi="field-groupable"> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
</group> | ||
<group key="wrapped-fields" gi="wrapped-fields"> | ||
<field scope="global" gi="field-wrappable"> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
</group> | ||
<group key="keyed-fields" gi="keyed-fields" json-key-flag="id"> | ||
<field scope="global" gi="field-by-key" json-key-flag="id"> | ||
<flag as-type="string" scope="global" key="id" gi="id"/> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
</group> | ||
<group key="dynamic-value-key-fields" gi="dynamic-value-key-fields"> | ||
<field scope="global" gi="field-dynamic-value-key"> | ||
<flag as-type="string" scope="global" key="id" gi="id"/> | ||
<value as-type="string" key-flag="id"/> | ||
</field> | ||
</group> | ||
<field scope="global" key="wrapped-prose" gi="wrapped-prose"> | ||
<value as-type="markup-multiline" key="PROSE"/> | ||
</field> | ||
<field scope="global" key="loose-prose"> | ||
<value as-type="markup-multiline" key="PROSE"/> | ||
</field> | ||
<assembly scope="global" key="assembly-1only" gi="assembly-1only"> | ||
<field scope="global" key="field-1only" gi="field-1only"> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
<assembly scope="global" key="assembly-1only" gi="assembly-1only"/> | ||
</assembly> | ||
<group key="groupable-assemblies" gi="groupable-assemblies"> | ||
<assembly scope="global" gi="assembly-groupable"> | ||
<group key="groupable-fields" gi="groupable-fields"> | ||
<field scope="global" gi="field-groupable"> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
</group> | ||
<group key="groupable-assemblies" gi="groupable-assemblies"> | ||
<assembly scope="global" gi="assembly-groupable"/> | ||
</group> | ||
</assembly> | ||
</group> | ||
<group key="wrapped-assemblies" gi="wrapped-assemblies"> | ||
<assembly scope="global" gi="assembly-wrappable"> | ||
<group key="wrapped-fields" gi="wrapped-fields"> | ||
<field scope="global" gi="field-wrappable"> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
</group> | ||
<group key="wrapped-assemblies" gi="wrapped-assemblies"> | ||
<assembly scope="global" gi="assembly-wrappable"/> | ||
</group> | ||
</assembly> | ||
</group> | ||
<group key="keyed-assemblies" gi="keyed-assemblies" json-key-flag="id"> | ||
<assembly scope="global" gi="assembly-by-key" json-key-flag="id"> | ||
<flag as-type="string" scope="global" key="id" gi="id"/> | ||
<group key="keyed-fields" gi="keyed-fields" json-key-flag="id"> | ||
<field scope="global" gi="field-by-key" json-key-flag="id"> | ||
<flag as-type="string" scope="global" key="id" gi="id"/> | ||
<value as-type="string" key="STRVALUE"/> | ||
</field> | ||
</group> | ||
<group key="keyed-assemblies" gi="keyed-assemblies" json-key-flag="id"> | ||
<assembly scope="global" gi="assembly-by-key" json-key-flag="id"/> | ||
</group> | ||
</assembly> | ||
</group> | ||
<group key="everything-recursive" gi="everything-recursive"> | ||
<assembly scope="global" gi="EVERYTHING"/> | ||
</group> | ||
</assembly> | ||
</map> |
89 changes: 89 additions & 0 deletions
89
test-suite/worked-examples/everything-metaschema/models-testdata.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<EVERYTHING xmlns="http://csrc.nist.gov/metaschema/ns/everything" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://csrc.nist.gov/metaschema/ns/everything file:/C:/Users/wap1/Documents/usnistgov/metaschema/test-suite/worked-examples/everything-metaschema/models_metaschema_XML-SCHEMA.xsd"> | ||
|
||
<field-1only>FIELD-1-ONLY</field-1only> | ||
<field-base64>1234abcd</field-base64> | ||
<field-named-value id="fnv1">FIELD-NAMED-VALUE</field-named-value> | ||
<field-groupable>field-groupable 1</field-groupable> | ||
<field-groupable>field-groupable 2</field-groupable> | ||
<field-groupable>field-groupable 3</field-groupable> | ||
<wrapped-fields> | ||
<field-wrappable>field-wrappable 1</field-wrappable> | ||
<field-wrappable>field-wrappable 2</field-wrappable> | ||
<field-wrappable>field-wrappable 3</field-wrappable> | ||
</wrapped-fields> | ||
<field-by-key id="fbk1">field-by-key 1</field-by-key> | ||
<field-by-key id="fbk2">field-by-key 2</field-by-key> | ||
<field-by-key id="fbk3">field-by-key 3</field-by-key> | ||
<field-dynamic-value-key id="fdvk1">field-dynamic-value-key 1</field-dynamic-value-key> | ||
<field-dynamic-value-key id="fdvk2">field-dynamic-value-key 2</field-dynamic-value-key> | ||
<field-dynamic-value-key id="fdvk3">field-dynamic-value-key 3</field-dynamic-value-key> | ||
|
||
<wrapped-prose> | ||
<h1>Wrapped up prose</h1> | ||
<p>This is prose. All wrapped up.</p> | ||
</wrapped-prose> | ||
<h1>Unwrapped prose</h1> | ||
<p>Here we have unwrapped prose....</p> | ||
<assembly-1only> | ||
<field-1only>ASSEMBLY-1-ONLY / FIELD-1-ONLY</field-1only> | ||
</assembly-1only> | ||
<assembly-groupable> | ||
<field-groupable>assembly-groupable 1 / field-groupable 1</field-groupable> | ||
<field-groupable>assembly-groupable 1 / field-groupable 2</field-groupable> | ||
<field-groupable>assembly-groupable 1 / field-groupable 3</field-groupable> | ||
</assembly-groupable> | ||
<assembly-groupable> | ||
<field-groupable>assembly-groupable 2 / field-groupable 1</field-groupable> | ||
<field-groupable>assembly-groupable 2 / field-groupable 2</field-groupable> | ||
<field-groupable>assembly-groupable 2 / field-groupable 3</field-groupable> | ||
</assembly-groupable> | ||
<assembly-groupable> | ||
<field-groupable>assembly-groupable 3 / field-groupable 1</field-groupable> | ||
<field-groupable>assembly-groupable 3 / field-groupable 2</field-groupable> | ||
<field-groupable>assembly-groupable 3 / field-groupable 3</field-groupable> | ||
</assembly-groupable> | ||
<wrapped-assemblies> | ||
<assembly-wrappable> | ||
<wrapped-fields> | ||
<field-wrappable>assembly-wrappable 1 / field-wrappable 1</field-wrappable> | ||
<field-wrappable>assembly-wrappable 1 / field-wrappable 2</field-wrappable> | ||
<field-wrappable>assembly-wrappable 1 / field-wrappable 3</field-wrappable> | ||
</wrapped-fields> | ||
</assembly-wrappable> | ||
<assembly-wrappable> | ||
<wrapped-fields> | ||
<field-wrappable>assembly-wrappable 2 / field-wrappable 1</field-wrappable> | ||
<field-wrappable>assembly-wrappable 2 / field-wrappable 2</field-wrappable> | ||
<field-wrappable>assembly-wrappable 2 / field-wrappable 3</field-wrappable> | ||
</wrapped-fields> | ||
</assembly-wrappable> | ||
<assembly-wrappable> | ||
<wrapped-fields> | ||
<field-wrappable>assembly-wrappable 3 / field-wrappable 1</field-wrappable> | ||
<field-wrappable>assembly-wrappable 3 / field-wrappable 2</field-wrappable> | ||
<field-wrappable>assembly-wrappable 3 / field-wrappable 3</field-wrappable> | ||
</wrapped-fields> | ||
</assembly-wrappable> | ||
</wrapped-assemblies> | ||
<assembly-by-key id="abk1"> | ||
<field-by-key id="abk1.fbk1">assembly-by-key 1 / field-by-key 1</field-by-key> | ||
<field-by-key id="abk1.fbk2">assembly-by-key 1 / field-by-key 2</field-by-key> | ||
<field-by-key id="abk1.fbk3">assembly-by-key 1 / field-by-key 3</field-by-key> | ||
</assembly-by-key> | ||
<assembly-by-key id="abk2"> | ||
<field-by-key id="abk2.fbk1">assembly-by-key 1 / field-by-key 1</field-by-key> | ||
<field-by-key id="abk2.fbk2">assembly-by-key 1 / field-by-key 2</field-by-key> | ||
<field-by-key id="abk2.fbk3">assembly-by-key 1 / field-by-key 3</field-by-key> | ||
</assembly-by-key> | ||
<assembly-by-key id="abk3"> | ||
<field-by-key id="abk3.fbk1">assembly-by-key 1 / field-by-key 1</field-by-key> | ||
<field-by-key id="abk3.fbk2">assembly-by-key 1 / field-by-key 2</field-by-key> | ||
<field-by-key id="abk3.fbk3">assembly-by-key 1 / field-by-key 3</field-by-key> | ||
</assembly-by-key> | ||
<everything> | ||
<field-1only>nested FIELD-1-ONLY</field-1only> | ||
</everything> | ||
</EVERYTHING> |
Oops, something went wrong.