forked from OpenSCAP/openscap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_schematron.sh
executable file
·53 lines (43 loc) · 2.36 KB
/
build_schematron.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
#
# Prerequisities
#
# 1. xsltproc tool
# $ yum install libxslt
#
# 2. ISO schematron XSLT v1 files
# $ wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/schematron/iso-schematron-xslt1.zip
# $ unzip iso-schematron-xslt1.zip
#
#
# 3. XSLT template to extract SCH from XSD
# $ wget https://github.com/OVALProject/Language/blob/${OVAL_VERSION}/tools/ExtractSchFromXSD.xsl
#
# Creating a validation XSL file
#
# 1. use xsltproc to create a *.sch file, e.g. for oval definitions:
# $ xsltproc ExtractSchFromXSD.xsl oval-definitions-schema.xsd > oval-definitions-schematron.sch
#
# 2. use xsltproc to generate target .xsl, which will be used to validate documents
# $ xsltproc iso_schematron_skeleton_for_xslt1.xsl oval-definitions-schematron.sch >oval/${OVAL_VERSION}/oval-definitions-schematron.xsl
#
# 3. Make sure you do not override workarounds we carry on. (You can use git-merge).
#
#
# Validating an document without oscap tool
#
# $ xsltproc oval/${OVAL_VERSION}/oval-definitions-schematron.xsl path/to/your/file.xml
version="$1"
wget -N https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/schematron/iso-schematron-xslt1.zip
unzip -o iso-schematron-xslt1.zip
wget https://github.com/OVALProject/Language/blob/$version/tools/ExtractSchFromXSD.xsl
xsltproc ExtractSchFromXSD.xsl oval-definitions-schema.xsd > oval-definitions-schematron.sch
xsltproc iso_schematron_skeleton_for_xslt1.xsl "oval-definitions-schematron.sch" >"oval-definitions-schematron.xsl"
xsltproc ExtractSchFromXSD.xsl oval-system-characteristics-schema.xsd > oval-system-characteristics-schematron.sch
xsltproc iso_schematron_skeleton_for_xslt1.xsl "oval-system-characteristics-schematron.sch" >"oval-system-characteristic-schematron.xsl"
xsltproc ExtractSchFromXSD.xsl oval-results-schema.xsd > oval-results-schematron.sch
xsltproc iso_schematron_skeleton_for_xslt1.xsl "oval-results-schematron.sch" >"oval-results-schematron.xsl"
xsltproc ExtractSchFromXSD.xsl oval-variables-schema.xsd > oval-variables-schematron.sch
xsltproc iso_schematron_skeleton_for_xslt1.xsl "oval-variables-schematron.sch" >"oval-variables-schematron.xsl"
xsltproc ExtractSchFromXSD.xsl oval-directives-schema.xsd > oval-directives-schematron.sch
xsltproc iso_schematron_skeleton_for_xslt1.xsl "oval-directives-schematron.sch" >"oval-directives-schematron.xsl"