Skip to content

Commit

Permalink
Merge pull request #78 from usnistgov/sprint-5
Browse files Browse the repository at this point in the history
Sprint 5
  • Loading branch information
david-waltermire authored Dec 4, 2017
2 parents 3bbd809 + e462bbf commit acb4721
Show file tree
Hide file tree
Showing 167 changed files with 597,857 additions and 314,165 deletions.
1,757 changes: 1,347 additions & 410 deletions OSCAL-dev.xpr

Large diffs are not rendered by default.

23 changes: 18 additions & 5 deletions docs/schema/oscal-docs-html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<title>
<xsl:value-of select="descendant::oscal:title[1]"/>
</title>
<!-- b/c XProc serialization doesn't do this -->
<meta charset="utf-8"/>
<style type="text/css">

section, div { margin-top:1em }
Expand Down Expand Up @@ -73,7 +75,7 @@ a:visited { color: midnightblue }
</xsl:template>


<xsl:template match="oscal:catalog | oscal:framework" mode="toc">
<xsl:template match="oscal:catalog | oscal:framework | oscal:worksheet" mode="toc">
<div id="toc-panel">
<xsl:apply-templates select="oscal:title" mode="toc"/>
<xsl:apply-templates select="oscal:section | oscal:group | oscal:control | oscal:component" mode="toc"/>
Expand All @@ -89,7 +91,7 @@ a:visited { color: midnightblue }

<xsl:template match="oscal:title" mode="toc">
<p class="toc-line">
<a href="#{generate-id(parent::*[not(self::oscal:catalog|self::oscal:framework)])}">
<a href="#{generate-id(parent::*[not(self::oscal:catalog|self::oscal:framework|self::oscal:worksheet)])}">
<xsl:apply-templates/>
</a>
</p>
Expand All @@ -111,13 +113,13 @@ a:visited { color: midnightblue }
</p>
</xsl:template>

<xsl:template match="oscal:catalog | oscal:framework">
<xsl:template match="oscal:catalog | oscal:framework | oscal:worksheet">
<div id="main" class="{local-name()}">
<xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template match="oscal:catalog/oscal:title | oscal:framework/oscal:title">
<xsl:template match="oscal:catalog/oscal:title | oscal:framework/oscal:title | oscal:worksheet/oscal:title">
<h1>
<xsl:apply-templates/>
</h1>
Expand Down Expand Up @@ -234,7 +236,13 @@ a:visited { color: midnightblue }
<xsl:apply-templates/>
</p>
</xsl:template>


<xsl:template match="oscal:pre">
<pre class="pre">
<xsl:apply-templates/>
</pre>
</xsl:template>

<xsl:template match="oscal:inject">
<xsl:variable name="param" select="@param-id"/>
<xsl:variable name="closest-param" select="ancestor-or-self::*/oscal:param[@id=$param][last()]"/>
Expand All @@ -256,6 +264,11 @@ a:visited { color: midnightblue }
<xsl:apply-templates/>
</ol>
</xsl:template>
<xsl:template match="oscal:ul">
<ul class="ul">
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="oscal:li">
<li class="li">
<xsl:apply-templates/>
Expand Down
15 changes: 9 additions & 6 deletions docs/schema/oscal-docs.sch
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

<!-- For validating oscal-oscal.xml against the schema (XSD) it purportedly describes.
Expand All @@ -18,25 +20,26 @@

<sch:ns uri="http://csrc.nist.gov/ns/oscal/1.0" prefix="oscal"/>

<sch:let name="schema-file" value="'../../working/lib/XSD/oscal-interim.xsd'"/>
<sch:let name="schema" value="document($schema-file)"/>
<sch:let name="schema-files" value="'../../schema/xml/XSD/oscal-core-interim.xsd', '../../schema/xml/XSD/oscal-profile.xsd'"/>
<sch:let name="schemas" value="document($schema-files)"/>

<sch:let name="element-declarations" value="$schema//xsd:element[exists(@name)]"/>
<sch:let name="element-declarations" value="$schemas//xsd:element[exists(@name)]"/>
<sch:let name="element-documentation" value="//oscal:component[@class='element-description']"/>

<sch:pattern>
<sch:rule context="/*">
<!--<sch:report test="true()"><sch:value-of select="count($element-declarations)"/></sch:report>-->
<sch:let name="undocumented-declarations" value="$element-declarations[not(@name=$element-documentation/oscal:prop[@class='tag'])]"/>
<sch:assert test="empty($undocumented-declarations)">
Schema <sch:value-of select="$schema-file"/> declares
Schemas <sch:value-of select="$schema-files"/> declare/s
<sch:value-of select="if (count($undocumented-declarations) eq 1) then 'this element, which is' else 'these elements, which are' "/>
undocumented: <sch:value-of select="string-join($undocumented-declarations/@name, ', ')"/>
</sch:assert>
</sch:rule>

<sch:rule context="oscal:component[@class='element-description']">
<sch:let name="gi" value="oscal:prop[@class='tag']"/>
<sch:assert test="exists($element-declarations[@name=$gi])">This element description corresponds to no declaration in <sch:value-of select="$schema-file"/></sch:assert>
<sch:assert test="exists($element-declarations[@name=$gi])">This element description corresponds to no declaration in <xsl:value-of separator=", " select="$schema-files"/></sch:assert>
</sch:rule>

<sch:rule context="oscal:part[@class='description']">
Expand Down
Loading

0 comments on commit acb4721

Please sign in to comment.