-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
produce-xml-converter.xsl: XSpec tests and minor XSLT improvements (#87)
* XSpec tests and minor XSLT improvements Co-authored-by: Wendell Piez <[email protected]>
- Loading branch information
1 parent
04a4a4c
commit a0816ac
Showing
7 changed files
with
25,499 additions
and
87 deletions.
There are no files selected for viewing
16,671 changes: 16,671 additions & 0 deletions
16,671
src/converter-gen/testing/definition-maps/assessment-plan-reduce-map-output.xml
Large diffs are not rendered by default.
Oops, something went wrong.
7,009 changes: 7,009 additions & 0 deletions
7,009
src/converter-gen/testing/definition-maps/profile-reduce-map-output.xml
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/converter-gen/testing/xml-converters/computer-build-xml-converter.xsl
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<XSLT:stylesheet xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0/supermodel" | ||
xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
xmlns:XSLT="http://www.w3.org/1999/XSL/Transform" version="3.0" | ||
exclude-result-prefixes="#all" | ||
xpath-default-namespace="http://csrc.nist.gov/ns/oscal/1.0"><XSLT:strip-space elements=""/><!-- METASCHEMA conversion stylesheet supports XML -> METASCHEMA/SUPERMODEL conversion --> | ||
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --> | ||
<!-- METASCHEMA: in namespace "http://csrc.nist.gov/ns/oscal/1.0"--> | ||
<XSLT:variable as="xs:string" name="metaschema-namespace" | ||
>http://csrc.nist.gov/ns/oscal/1.0</XSLT:variable> | ||
</XSLT:stylesheet> |
84 changes: 84 additions & 0 deletions
84
src/converter-gen/testing/xml-to-json/produce-xml-converter-json-usage.xspec
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,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<x:description | ||
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0" | ||
xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0" | ||
xmlns:mt="http://csrc.nist.gov/ns/oscal/metaschema/xspec/testing" | ||
xmlns:sm="http://csrc.nist.gov/ns/oscal/metaschema/1.0/supermodel" | ||
xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
xmlns:XSLT="http://www.w3.org/1999/XSL/Transform" | ||
stylesheet="../../json-to-xml/produce-json-converter.xsl" | ||
xslt-version="3.0"> | ||
|
||
<!-- This XSpec file tests that certain code located in | ||
produce-xml-converter.xsl either | ||
a) Gets reached in a different manner from | ||
produce-json-converter.xsl, such as by name instead of | ||
by match or using a different mode, or | ||
b) Does not get reached (i.e., is overridden) when | ||
the top-level stylesheet is produce-json-converter.xsl. | ||
--> | ||
|
||
<x:variable name="source-namespace" select="'http://csrc.nist.gov/ns/oscal/1.0'"/> | ||
<x:variable name="source-prefix" select="'oscal-profile'"/> | ||
|
||
<x:helper stylesheet="test-helper-xml-to-json.xsl"/> | ||
|
||
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --> | ||
<!-- produce-json-converter.xsl reaches these templates by name | ||
instead of by match --> | ||
<x:scenario label="Tests for name=make-template template" pending="TODO"> | ||
<!-- TODO: Among other things, check for applying templates in mode=make-key-flag, | ||
which is empty in XML converter but not empty in JSON converter. --> | ||
</x:scenario> | ||
|
||
<x:scenario label="Tests for name=make-full-context-match template" pending="TODO"> | ||
</x:scenario> | ||
|
||
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --> | ||
<!-- produce-json-converter.xsl reaches these templates by | ||
mode=make-json-pull instead of mode=make-xml-pull --> | ||
<x:scenario label="Tests for match=* mode=make-json-pull template" pending="TODO"> | ||
</x:scenario> | ||
|
||
<x:scenario label="Tests for match=choice mode=make-json-pull template" pending="TODO"> | ||
</x:scenario> | ||
|
||
<x:scenario label="Tests for match=constraint mode=make-json-pull template" pending="TODO"> | ||
</x:scenario> | ||
|
||
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --> | ||
<!-- produce-json-converter.xsl overrides the templates in | ||
produce-xml-converter.xsl --> | ||
<x:scenario label="Tests for match=* mode=make-match template" pending="TODO"> | ||
</x:scenario> | ||
|
||
<x:scenario label="Tests for match=* mode=make-pull template"> | ||
<!-- The purpose of make-pull mode is route to either make-xml-pull | ||
or make-json-pull mode, depending on whether the top-level stylesheet | ||
is produce-xml-converter.xsl or produce-json-converter.xsl. | ||
Check that we reached the JSON stub template in the helper XSLT. --> | ||
<x:context mode="make-pull"> | ||
<mt:any-element xmlns="">stub</mt:any-element> | ||
</x:context> | ||
<x:expect label="Reached make-json-pull mode for the context element"> | ||
<!--Reached make-json-pull mode--> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="Tests for match=field[empty(@gi)][@as-type='markup-multiline'] mode=make-template template" pending="TODO"> | ||
</x:scenario> | ||
|
||
<x:scenario label="Tests for name=comment-template template"> | ||
<x:context> | ||
<mt:any-element xmlns="">stub</mt:any-element> | ||
</x:context> | ||
<x:call template="comment-template"/> | ||
<!-- TODO: When I do more with make-xml-match mode, decide if I want to stop using a stub --> | ||
<x:expect label="XML comment with some text from make-xml-match mode (stubbed for testing)"> | ||
<!-- XML match="Reached make-xml-match mode for any-element" --> | ||
</x:expect> | ||
</x:scenario> | ||
|
||
<x:scenario label="Tests for name=for-this-converter template" pending="TODO"> | ||
</x:scenario> | ||
</x:description> |
Oops, something went wrong.