Skip to content

Commit 95577cd

Browse files
committed
Add OVAL 5.11.3 schematrons
1 parent 778dd61 commit 95577cd

File tree

6 files changed

+25536
-0
lines changed

6 files changed

+25536
-0
lines changed

schemas/oval/5.11.3/oval-definitions-schematron.xsl

Lines changed: 7835 additions & 0 deletions
Large diffs are not rendered by default.

schemas/oval/5.11.3/oval-directives-schematron.xsl

Lines changed: 8528 additions & 0 deletions
Large diffs are not rendered by default.

schemas/oval/5.11.3/oval-results-schematron.xsl

Lines changed: 8528 additions & 0 deletions
Large diffs are not rendered by default.

schemas/oval/5.11.3/oval-system-characteristic-schematron.xsl

Lines changed: 559 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" standalone="yes"?>
2+
<axsl:stylesheet xmlns:axsl="http://www.w3.org/1999/XSL/Transform" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:iso="http://purl.oclc.org/dsdl/schematron" xmlns:oval-var="http://oval.mitre.org/XMLSchema/oval-variables-5" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" version="1.0"><!--Implementers: please note that overriding process-prolog or process-root is
3+
the preferred method for meta-stylesheets to use where possible. -->
4+
<axsl:param name="archiveDirParameter"/><axsl:param name="archiveNameParameter"/><axsl:param name="fileNameParameter"/><axsl:param name="fileDirParameter"/>
5+
6+
<!--PHASES-->
7+
8+
9+
<!--PROLOG-->
10+
11+
12+
<!--KEYS-->
13+
14+
15+
<!--DEFAULT RULES-->
16+
17+
18+
<!--MODE: SCHEMATRON-SELECT-FULL-PATH-->
19+
<!--This mode can be used to generate an ugly though full XPath for locators-->
20+
<axsl:template match="*" mode="schematron-select-full-path"><axsl:apply-templates select="." mode="schematron-get-full-path"/></axsl:template>
21+
22+
<!--MODE: SCHEMATRON-FULL-PATH-->
23+
<!--This mode can be used to generate an ugly though full XPath for locators-->
24+
<axsl:template match="*" mode="schematron-get-full-path"><axsl:apply-templates select="parent::*" mode="schematron-get-full-path"/><axsl:text>/</axsl:text><axsl:choose><axsl:when test="namespace-uri()=''"><axsl:value-of select="name()"/><axsl:variable name="p_1" select="1+ count(preceding-sibling::*[name()=name(current())])"/><axsl:if test="$p_1&gt;1 or following-sibling::*[name()=name(current())]">[<axsl:value-of select="$p_1"/>]</axsl:if></axsl:when><axsl:otherwise><axsl:text>*[local-name()='</axsl:text><axsl:value-of select="local-name()"/><axsl:text>' and namespace-uri()='</axsl:text><axsl:value-of select="namespace-uri()"/><axsl:text>']</axsl:text><axsl:variable name="p_2" select="1+ count(preceding-sibling::*[local-name()=local-name(current())])"/><axsl:if test="$p_2&gt;1 or following-sibling::*[local-name()=local-name(current())]">[<axsl:value-of select="$p_2"/>]</axsl:if></axsl:otherwise></axsl:choose></axsl:template><axsl:template match="@*" mode="schematron-get-full-path"><axsl:text>/</axsl:text><axsl:choose><axsl:when test="namespace-uri()=''">@<axsl:value-of select="name()"/></axsl:when><axsl:otherwise><axsl:text>@*[local-name()='</axsl:text><axsl:value-of select="local-name()"/><axsl:text>' and namespace-uri()='</axsl:text><axsl:value-of select="namespace-uri()"/><axsl:text>']</axsl:text></axsl:otherwise></axsl:choose></axsl:template>
25+
26+
<!--MODE: SCHEMATRON-FULL-PATH-2-->
27+
<!--This mode can be used to generate prefixed XPath for humans-->
28+
<axsl:template match="node() | @*" mode="schematron-get-full-path-2"><axsl:for-each select="ancestor-or-self::*"><axsl:text>/</axsl:text><axsl:value-of select="name(.)"/><axsl:if test="preceding-sibling::*[name(.)=name(current())]"><axsl:text>[</axsl:text><axsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1"/><axsl:text>]</axsl:text></axsl:if></axsl:for-each><axsl:if test="not(self::*)"><axsl:text/>/@<axsl:value-of select="name(.)"/></axsl:if></axsl:template>
29+
30+
<!--MODE: GENERATE-ID-FROM-PATH -->
31+
<axsl:template match="/" mode="generate-id-from-path"/><axsl:template match="text()" mode="generate-id-from-path"><axsl:apply-templates select="parent::*" mode="generate-id-from-path"/><axsl:value-of select="concat('.text-', 1+count(preceding-sibling::text()), '-')"/></axsl:template><axsl:template match="comment()" mode="generate-id-from-path"><axsl:apply-templates select="parent::*" mode="generate-id-from-path"/><axsl:value-of select="concat('.comment-', 1+count(preceding-sibling::comment()), '-')"/></axsl:template><axsl:template match="processing-instruction()" mode="generate-id-from-path"><axsl:apply-templates select="parent::*" mode="generate-id-from-path"/><axsl:value-of select="concat('.processing-instruction-', 1+count(preceding-sibling::processing-instruction()), '-')"/></axsl:template><axsl:template match="@*" mode="generate-id-from-path"><axsl:apply-templates select="parent::*" mode="generate-id-from-path"/><axsl:value-of select="concat('.@', name())"/></axsl:template><axsl:template match="*" mode="generate-id-from-path" priority="-0.5"><axsl:apply-templates select="parent::*" mode="generate-id-from-path"/><axsl:text>.</axsl:text><axsl:value-of select="concat('.',name(),'-',1+count(preceding-sibling::*[name()=name(current())]),'-')"/></axsl:template><!--MODE: SCHEMATRON-FULL-PATH-3-->
32+
<!--This mode can be used to generate prefixed XPath for humans
33+
(Top-level element has index)-->
34+
<axsl:template match="node() | @*" mode="schematron-get-full-path-3"><axsl:for-each select="ancestor-or-self::*"><axsl:text>/</axsl:text><axsl:value-of select="name(.)"/><axsl:if test="parent::*"><axsl:text>[</axsl:text><axsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1"/><axsl:text>]</axsl:text></axsl:if></axsl:for-each><axsl:if test="not(self::*)"><axsl:text/>/@<axsl:value-of select="name(.)"/></axsl:if></axsl:template>
35+
36+
<!--MODE: GENERATE-ID-2 -->
37+
<axsl:template match="/" mode="generate-id-2">U</axsl:template><axsl:template match="*" mode="generate-id-2" priority="2"><axsl:text>U</axsl:text><axsl:number level="multiple" count="*"/></axsl:template><axsl:template match="node()" mode="generate-id-2"><axsl:text>U.</axsl:text><axsl:number level="multiple" count="*"/><axsl:text>n</axsl:text><axsl:number count="node()"/></axsl:template><axsl:template match="@*" mode="generate-id-2"><axsl:text>U.</axsl:text><axsl:number level="multiple" count="*"/><axsl:text>_</axsl:text><axsl:value-of select="string-length(local-name(.))"/><axsl:text>_</axsl:text><axsl:value-of select="translate(name(),':','.')"/></axsl:template><!--Strip characters--><axsl:template match="text()" priority="-1"/>
38+
39+
<!--SCHEMA METADATA-->
40+
<axsl:template match="/"><axsl:apply-templates select="/" mode="M3"/><axsl:apply-templates select="/" mode="M4"/><axsl:apply-templates select="/" mode="M5"/><axsl:apply-templates select="/" mode="M6"/></axsl:template>
41+
42+
<!--SCHEMATRON PATTERNS-->
43+
44+
45+
<!--PATTERN oval_schema_version_one_core_element-->
46+
47+
48+
<!--RULE -->
49+
<axsl:template match="oval-def:oval_definitions/oval-def:generator" priority="1000" mode="M3">
50+
51+
<!--ASSERT -->
52+
<axsl:choose><axsl:when test="count(oval:schema_version[not(@platform)]) = 1"/><axsl:otherwise>One (and only one) schema_version element MUST be present and omit the platform attribute to represent the core version.<axsl:value-of select="string('&#10;')"/></axsl:otherwise></axsl:choose><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M3"/></axsl:template><axsl:template match="text()" priority="-1" mode="M3"/><axsl:template match="@*|node()" priority="-2" mode="M3"><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M3"/></axsl:template>
53+
54+
<!--PATTERN oval_schema_version_empty_platform-->
55+
56+
57+
<!--RULE -->
58+
<axsl:template match="oval-def:oval_definitions/oval-def:generator/oval:schema_version[@platform]" priority="1000" mode="M4">
59+
60+
<!--REPORT -->
61+
<axsl:if test="@platform = ''">Warning: The platform attribute should be set to the URI of the target namespace for this platform extension.<axsl:value-of select="string('&#10;')"/></axsl:if><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M4"/></axsl:template><axsl:template match="text()" priority="-1" mode="M4"/><axsl:template match="@*|node()" priority="-2" mode="M4"><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M4"/></axsl:template>
62+
63+
<!--PATTERN oval_schema_version_core_matches_platforms-->
64+
65+
66+
<!--RULE -->
67+
<axsl:template match="oval-def:oval_definitions/oval-def:generator/oval:schema_version[@platform]" priority="1000" mode="M5"><axsl:variable name="core_version_portion" select="parent::oval-def:generator/oval:schema_version[not(@platform)]"/>
68+
69+
<!--ASSERT -->
70+
<axsl:choose><axsl:when test="starts-with(.,$core_version_portion)"/><axsl:otherwise>This platform's version (<axsl:text/><axsl:value-of select="."/><axsl:text/>) MUST match the core version being used: <axsl:text/><axsl:value-of select="$core_version_portion"/><axsl:text/>.<axsl:value-of select="string('&#10;')"/></axsl:otherwise></axsl:choose><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M5"/></axsl:template><axsl:template match="text()" priority="-1" mode="M5"/><axsl:template match="@*|node()" priority="-2" mode="M5"><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M5"/></axsl:template>
71+
72+
<!--PATTERN oval_none_exist_value_dep-->
73+
74+
75+
<!--RULE -->
76+
<axsl:template match="oval-def:oval_definitions/oval-def:tests/child::*" priority="1000" mode="M6">
77+
78+
<!--REPORT -->
79+
<axsl:if test="@check='none exist'">
80+
DEPRECATED ATTRIBUTE VALUE IN: <axsl:text/><axsl:value-of select="name()"/><axsl:text/> ATTRIBUTE VALUE:
81+
<axsl:value-of select="string('&#10;')"/></axsl:if><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M6"/></axsl:template><axsl:template match="text()" priority="-1" mode="M6"/><axsl:template match="@*|node()" priority="-2" mode="M6"><axsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M6"/></axsl:template></axsl:stylesheet>

src/source/schematron.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct oscap_schema_table_entry OSCAP_SCHEMATRON_TABLE[] = {
5151
{OSCAP_DOCUMENT_OVAL_DEFINITIONS, "5.11", "oval/5.11/oval-definitions-schematron.xsl"},
5252
{OSCAP_DOCUMENT_OVAL_DEFINITIONS, "5.11.1", "oval/5.11.1/oval-definitions-schematron.xsl"},
5353
{OSCAP_DOCUMENT_OVAL_DEFINITIONS, "5.11.2", "oval/5.11.2/oval-definitions-schematron.xsl"},
54+
{OSCAP_DOCUMENT_OVAL_DEFINITIONS, "5.11.3", "oval/5.11.3/oval-definitions-schematron.xsl"},
5455
{OSCAP_DOCUMENT_OVAL_SYSCHAR, "5.3", "oval/5.3/oval-system-characteristics-schematron.xsl"},
5556
{OSCAP_DOCUMENT_OVAL_SYSCHAR, "5.4", "oval/5.4/oval-system-characteristics-schematron.xsl"},
5657
{OSCAP_DOCUMENT_OVAL_SYSCHAR, "5.5", "oval/5.5/oval-system-characteristics-schematron.xsl"},
@@ -63,6 +64,7 @@ struct oscap_schema_table_entry OSCAP_SCHEMATRON_TABLE[] = {
6364
{OSCAP_DOCUMENT_OVAL_SYSCHAR, "5.11", "oval/5.11/oval-system-characteristics-schematron.xsl"},
6465
{OSCAP_DOCUMENT_OVAL_SYSCHAR, "5.11.1", "oval/5.11.1/oval-system-characteristics-schematron.xsl"},
6566
{OSCAP_DOCUMENT_OVAL_SYSCHAR, "5.11.2", "oval/5.11.2/oval-system-characteristics-schematron.xsl"},
67+
{OSCAP_DOCUMENT_OVAL_SYSCHAR, "5.11.3", "oval/5.11.3/oval-system-characteristics-schematron.xsl"},
6668
{OSCAP_DOCUMENT_OVAL_RESULTS, "5.3", "oval/5.3/oval-results-schematron.xsl"},
6769
{OSCAP_DOCUMENT_OVAL_RESULTS, "5.4", "oval/5.4/oval-results-schematron.xsl"},
6870
{OSCAP_DOCUMENT_OVAL_RESULTS, "5.5", "oval/5.5/oval-results-schematron.xsl"},
@@ -75,6 +77,7 @@ struct oscap_schema_table_entry OSCAP_SCHEMATRON_TABLE[] = {
7577
{OSCAP_DOCUMENT_OVAL_RESULTS, "5.11", "oval/5.11/oval-results-schematron.xsl"},
7678
{OSCAP_DOCUMENT_OVAL_RESULTS, "5.11.1", "oval/5.11.1/oval-results-schematron.xsl"},
7779
{OSCAP_DOCUMENT_OVAL_RESULTS, "5.11.2", "oval/5.11.2/oval-results-schematron.xsl"},
80+
{OSCAP_DOCUMENT_OVAL_RESULTS, "5.11.3", "oval/5.11.3/oval-results-schematron.xsl"},
7881
{OSCAP_DOCUMENT_OVAL_VARIABLES, "5.3", "oval/5.3/oval-variables-schematron.xsl"},
7982
{OSCAP_DOCUMENT_OVAL_VARIABLES, "5.4", "oval/5.4/oval-variables-schematron.xsl"},
8083
{OSCAP_DOCUMENT_OVAL_VARIABLES, "5.5", "oval/5.5/oval-variables-schematron.xsl"},
@@ -87,13 +90,15 @@ struct oscap_schema_table_entry OSCAP_SCHEMATRON_TABLE[] = {
8790
{OSCAP_DOCUMENT_OVAL_VARIABLES, "5.11", "oval/5.11/oval-variables-schematron.xsl"},
8891
{OSCAP_DOCUMENT_OVAL_VARIABLES, "5.11.1", "oval/5.11.1/oval-variables-schematron.xsl"},
8992
{OSCAP_DOCUMENT_OVAL_VARIABLES, "5.11.2", "oval/5.11.2/oval-variables-schematron.xsl"},
93+
{OSCAP_DOCUMENT_OVAL_VARIABLES, "5.11.3", "oval/5.11.3/oval-variables-schematron.xsl"},
9094
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.8", "oval/5.8/oval-directives-schematron.xsl"},
9195
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.9", "oval/5.9/oval-directives-schematron.xsl"},
9296
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.10", "oval/5.10/oval-directives-schematron.xsl"},
9397
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.10.1", "oval/5.10.1/oval-directives-schematron.xsl"},
9498
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.11", "oval/5.11/oval-directives-schematron.xsl"},
9599
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.11.1", "oval/5.11.1/oval-directives-schematron.xsl"},
96100
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.11.2", "oval/5.11.2/oval-directives-schematron.xsl"},
101+
{OSCAP_DOCUMENT_OVAL_DIRECTIVES, "5.11.3", "oval/5.11.3/oval-directives-schematron.xsl"},
97102
{OSCAP_DOCUMENT_XCCDF, "1.2", "xccdf/1.2/xccdf_1.2-schematron.xsl"},
98103
};
99104

0 commit comments

Comments
 (0)