Skip to content

Commit

Permalink
Tutorial work in progress, with XProc indexing (#16)
Browse files Browse the repository at this point in the history
Tutorial including sources, production pipelines, and Markdown outputs, in draft.
With at least two new demonstration projects - OSCAL from PDF via HTML (US Army FM6-22), and OSCAL from JSON (CPRT/SP800-171)
---------

Co-authored-by: Amanda Galtman <[email protected]>
  • Loading branch information
wendellpiez and galtm authored Dec 20, 2024
1 parent 79e0675 commit 600eaf0
Show file tree
Hide file tree
Showing 254 changed files with 91,644 additions and 235 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ jobs:
id: setup
- name: Run smoketests
run: |
./xp3.sh smoketest/POWER-UP.xpl
./xp3.sh smoketest/SMOKETEST-SCHEMATRON.xpl -silent
./xp3.sh smoketest/SMOKETEST-XSPEC.xpl -silent
./xp3.sh smoketest/TEST-XPROC3.xpl
./xp3.sh smoketest/TEST-SCHEMATRON.xpl -silent
./xp3.sh smoketest/TEST-XSPEC.xpl -silent
id: exec_smoketests
- name: Run tests
run: |
./xp3.sh testing/REPO-FILESET-CHECK.xpl -silent
./xp3.sh testing/HARDFAIL-XPROC3-HOUSE-RULES.xpl -silent
./xp3.sh testing/RUN_XSPEC-JUNIT_BATCH.xpl -silent
id: exec_tests
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# IDE project file
*.xpr

# Local working files
working/
scratch/

# contents of lib
lib/*
# except for important items
Expand Down
127 changes: 88 additions & 39 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ XProc conformance testing is [documented for Morgana on its site](https://test-s

Java is a requirement. For setup instructions, see the [README.md](README.md), the [more detailed setup notes](setup-notes.md), or try the bash script, `./setup.sh`.

Test the operation of an XProc3 pipeline with the [Smoke test](smoketest/POWER-UP.xpl) pipeline. You should see no figurative smoke:
Test the operation of an XProc3 pipeline with the [Smoke test](smoketest/TEST-XPROC3.xpl) pipeline. You should see no figurative smoke:

```
> ./xp3.sh XPROC3-SMOKETEST.xpl
Expand All @@ -24,11 +24,11 @@ Windows users with no `bash` can use the `xp3.bat` utility instead.

### Assorted smoke tests

In addition to [smoketest/POWER-UP.xpl](smoketest/POWER-UP.xpl)
In addition to [smoketest/TEST-XPROC3.xpl](smoketest/TEST-XPROC3.xpl)

[smoketest/SMOKETEST-XSLT.xpl](smoketest/SMOKETEST-XSLT.xpl) tests XSLT transformations (requires Saxon installation)
[smoketest/TEST-XSLT.xpl](smoketest/TEST-XSLT.xpl) tests XSLT transformations (requires Saxon installation)

[smoketest/SMOKETEST-SCHEMATRON.xpl](smoketest/SMOKETEST-SCHEMATRON.xpl) tests Schematron validation (requires Saxon and SchXSLT installation) - returning SVRL code.
[smoketest/TEST-SCHEMATRON.xpl](smoketest/TEST-SCHEMATRON.xpl) tests Schematron validation (requires Saxon and SchXSLT installation) - returning SVRL code.

Beginning developers might take the time to inspect and edit this smoke test and the Schematron it uses, as it can show the different behaviors when (a) the document is valid or invalid to the Schematron (as written, all documents are always valid), or (b) the pipeline is set to *require* validity or not (`assert-valid='true'`).

Expand Down
2 changes: 1 addition & 1 deletion THIRD_PARTY_LICENSES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

OSCAL-XProc relies on these open-source software packages:

- [MorganaXProcIII](https://www.xml-project.com/morganaxproc-iiise.html) from [&lt;xml-project />](https://www.xml-project.com)
- [MorganaXProc-III](https://www.xml-project.com/morganaxproc-iiise.html) from [&lt;xml-project />](https://www.xml-project.com)
- Saxon 12 from [Saxonica](https://www.saxonica.com/)
- [SchXSLT](https://github.com/schxslt/schxslt) by David Maus, a Schematron implementation
- Their dependencies, including Java.
Expand Down
1 change: 0 additions & 1 deletion icons/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ In an effort to support [XProc 3.0](https://xproc.org) branding and awareness ef
Like everything on this site, these productions are placed in the public domain, with [no warranty](../LICENSE.md), only the hope they may be useful. Please reuse, alter and appropriate as you see fit, giving credit for originals.

![Kanava the XProc fish, in a fishbowl](fishbowl.svg)

19 changes: 10 additions & 9 deletions lib/GRAB-SAXON.xpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
type="ox:GRAB-SAXON"
name="GRAB-SAXON">


<!-- /end prologue -->
<!-- start subpipeline -->

<p:variable name="download-path" select="'https://www.saxonica.com/download'"/>
<!--<p:variable name="download-path" select="'.'"/>-->
<p:variable name="archive-basename" select="''"/>
<p:variable name="jarfile" select="'saxon-he-12.3.jar'"/>
<p:variable name="jarfile" select="'saxon-he-12.5.jar'"/>

<p:variable name="zip-name" select="'SaxonHE12-3J.zip'"/>
<p:variable name="zip-name" select="'SaxonHE12-5J.zip'"/>

<p:variable name="target-dir" select="'MorganaXProc-IIIse-1.4/MorganaXProc-IIIse_lib' => resolve-uri()"/>

<p:variable name="target-dir" select="'MorganaXProc-IIIse-1.3.7/MorganaXProc-IIIse_lib'"/>
<p:variable name="whither" select="resolve-uri($target-dir, static-base-uri())"/>

<p:variable name="prefix" select="'[' || 'GRAB-SAXON' || ']'"/>

<!-- It beginneth -->
Expand All @@ -26,10 +27,10 @@

<!-- see p:unarchive here: https://spec.xproc.org/3.0/steps/#c.unarchive -->
<p:unarchive message="{$prefix} Unzipping { $zip-name }"
include-filter="saxon-he-12.3.jar"/>
include-filter="{ $jarfile }"/>

<p:store href="{ $whither }/{ $jarfile }" message="{$prefix} Saving { $whither }/{ $jarfile }"/>
<p:store href="{ $target-dir }/{ $jarfile }" message="{$prefix} Saving { $target-dir }/{ $jarfile }"/>

<p:identity message="{ $prefix } Test your XSLT transformation capability using ../smoketest/SMOKETEST-XSLT.xpl"/>
<p:identity message="{ $prefix } Test your XSLT transformation capability using ../smoketest/TEST-XSLT.xpl"/>

</p:declare-step>
10 changes: 5 additions & 5 deletions lib/GRAB-SCHXSLT.xpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@


<!-- SchXSLT is at https://github.com/schxslt/schxslt
It is an XSLT-based Schematron processor
-->
It is an XSLT-based Schematron processor -->

<!-- /end prologue -->
<!-- start subpipeline -->

<p:variable name="download-path" select="'https://github.com/schxslt/schxslt/releases/download/v1.9.5'"/>
<!--<p:variable name="download-path" select="'.'"/>-->
Expand Down Expand Up @@ -38,6 +38,6 @@
<p:store href="{ $path-here }" message="{$prefix} Saving { $path-here }"/>
</p:for-each>

<p:identity message="{ $prefix } Test your Schematron capability using ../smoketest/SMOKETEST-SCHEMATRON.xpl"/>
<p:identity message="{ $prefix } Test your Schematron capability using ../smoketest/TEST-SCHEMATRON.xpl"/>

</p:declare-step>
15 changes: 8 additions & 7 deletions lib/GRAB-XSPEC.xpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@


<!-- XSpec is an XSLT-based unit testing framework
for XSLT, XQuery and Schematron
-->
for XSLT, XQuery and Schematron -->

<!--https://github.com/xspec/xspec/archive/refs/tags/v3.0.3.zip-->

<!-- /end prologue -->
<!-- start subpipeline -->

<p:variable name="download" select="'https://github.com/xspec/xspec/archive/refs/tags/v3.0.3.zip'"/>
<!--<p:variable name="download" select="'xspec-3.0.3.zip'"/>-->
<p:variable name="archive-basename" select="'xspec-3.1.2'"/>

<p:variable name="archive-basename" select="'xspec-3.0.3'"/>
<p:variable name="download" select="'https://github.com/xspec/xspec/archive/refs/tags/v3.1.2.zip'"/>
<!--<p:variable name="download" select="'xspec-3.0.3.zip'"/>-->

<p:variable name="zip-name" select="$archive-basename || '.zip'"/>

Expand All @@ -43,6 +44,6 @@
<p:store href="{ $path-here }" message="{$prefix} Saving { $path-here }"/>
</p:for-each>

<p:identity message="{ $prefix } Test your XSpec capability using ../smoketest/SMOKETEST-XSPEC.xpl"/>
<p:identity message="{ $prefix } Test your XSpec capability using ../smoketest/TEST-XSPEC.xpl"/>

</p:declare-step>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,25 @@

<!-- Purpose: update local copies of some OSCAL resources from its release repository -->


<!-- Schematron validating this XProc or any project XProc can be found
in the ../testing directory -
../testing/xproc3-house-rules.sch
with harnesses for running
don't neglect -->

<p:input port="resource-names">
<p:inline>
<download path="https://github.com/usnistgov/OSCAL/releases/download/v1.1.2">
<!-- OSCAL catalog schemas and converters are as good as anything for demonstration -->
<resource>oscal_catalog_schema.xsd</resource>
<resource>oscal_profile_schema.xsd</resource>
</download>
</p:inline>
</p:input>

<p:variable name="download-path" select="download/@path/string(.)"/>
<p:variable name="download-path" select="'https://github.com/usnistgov/OSCAL/releases/download/v1.1.2'"/>


<!-- A $prefix is used to tag messages, expected to match the process type -->
<p:variable name="prefix" select="'[' || 'GRAB-RESOURCES' || ']'"/>

<p:for-each message="{$prefix} Saving resources in ./lib ...">
<!-- iterating over each 'resource' as a discrete document node -->
<p:with-input select="download/resource"/>
<p:variable name="filename" select="string(.)"/>
<p:with-input>
<p:document href="{$download-path}/oscal_catalog_schema.xsd"/>
<p:document href="{$download-path}/oscal_profile_schema.xsd"/>
</p:with-input>
<p:variable name="filename" select="p:document-property(.,'base-uri') ! replace(.,'.*/','')"/>

<!-- No exception handling since a failed load often produces a result
making it difficult to anticipate what a failure looks like - -->
<!-- NB - A Schematron error comes back as soon as this is out of line with /*/@type i.e. the file name
- starting the @message with { $prefix } silences the error, but please reset $prefix -->
<p:load message="[GRAB-RESOURCES] Loading { $filename} from { $download-path } ..."
href="{ $download-path }/{ $filename }" />

<p:store message="{$prefix} ... saving { $filename }"
href="lib/{ $filename }"/>
</p:for-each>
Expand Down
12 changes: 12 additions & 0 deletions project-template/MINIMAL.xpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step" version="3.0"
xmlns:ox="http://csrc.nist.gov/ns/oscal-xproc3"
type="ox:MINIMAL"
name="MINIMAL">

<!-- For samples and boilerplate see file ../projects/xproc-doc/xproc-snippets.xml -->

<p:identity/>

</p:declare-step>
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions projects/CPRT-import/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Everything inside temp
temp/*
Loading

0 comments on commit 600eaf0

Please sign in to comment.