-
Notifications
You must be signed in to change notification settings - Fork 9
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
produce-xml-converter.xsl: XSpec tests and minor XSLT improvements #87
Merged
wendellpiez
merged 3 commits into
usnistgov:merge-June2024
from
galtm:testing-produce-xml-converter
Jun 7, 2024
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO notations in this file are because I jotted down needs for future work. I anticipate that the work would be a separate pull request.