Skip to content

Commit

Permalink
Patch to rc2->v1.0.0 content converter addresses usnistgov#958 (usnis…
Browse files Browse the repository at this point in the history
…tgov#960)

Co-authored-by: David Waltermire <[email protected]>
  • Loading branch information
wendellpiez and david-waltermire authored Jun 10, 2021
1 parent 367b23d commit 5b2d93e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/release/content-upgrade/oscal-rc2-v1-0-0-update.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
<!-- This XSLT, applied to an XML document valid to the Milestone 3 OSCAL schema version for Catalog, Profile, SSP or Component,
will produce a similar XML document, valid or closer to valid to the Release Candidate 1 OSCAL schema. -->
<xsl:output indent="yes"/>

<xsl:mode on-no-match="shallow-copy"/>

<xsl:mode name="copy" on-no-match="shallow-copy"/>

<xsl:variable select="uuid:randomUUID()" name="new-document-uuid"/>

<xsl:template match="/comment()"/>

<xsl:template match="/*">
<xsl:comment expand-text="true"> Modified by the OSCAL 1.0.0 RC2 to OSCAL 1.0.0 conversion XSLT on { current-dateTime() } </xsl:comment>
<xsl:copy>
Expand All @@ -21,25 +26,32 @@
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

<xsl:template match="oscal-version">
<oscal-version>1.0.0</oscal-version>
</xsl:template>

<xsl:template match="last-modified" expand-text="true">
<last-modified>{ current-dateTime() }</last-modified>
</xsl:template>

<!-- Usage change: we no longer permit spaces in values of select/@how-many -->
<xsl:template match="select/@how-many" expand-text="true">
<!-- trims and replaces remaining spaces with hyphens -->
<xsl:attribute name="how-many" select="normalize-space() ! replace(.,' ','-')"/>
</xsl:template>

<!-- METASCHEMA MODULE oscal_catalog_metaschema.xml-->
<!-- Catalog format changes only 'NCName' values to 'token' -->

<!-- METASCHEMA MODULE oscal_metadata_metaschema.xml-->
<xsl:template match="back-matter//biblio">
<xsl:message>'biblio' element is dropped from data in conversion (as it is no longer supported in OSCAL).</xsl:message>
</xsl:template>

<!-- METASCHEMA MODULE oscal_control-common_metaschema.xml-->
<!-- only 'NCName' to 'token' -->

<!-- METASCHEMA MODULE oscal_profile_metaschema.xml-->
<xsl:template match="set-parameter">
<xsl:copy>
Expand All @@ -54,8 +66,30 @@
<xsl:apply-templates select="select"/>
</xsl:copy>
</xsl:template>

<xsl:template match="add/@id-ref | remove/@id-ref">
<xsl:attribute name="by-id" select="."/>
</xsl:template>

<xsl:template match="remove/@name-ref">
<xsl:attribute name="by-name" select="."/>
</xsl:template>

<xsl:template match="remove/@class-ref">
<xsl:attribute name="by-class" select="."/>
</xsl:template>

<xsl:template match="remove/@item-name">
<xsl:attribute name="by-item-name" select="."/>
</xsl:template>

<xsl:template match="remove/@ns-ref">
<xsl:attribute name="by-ns" select="."/>
</xsl:template>

<!-- METASCHEMA MODULE oscal_ssp_metaschema.xml -->
<!-- responsible-role was added (back) to statement; many BY_KEY were switched to ARRAY group types-->

<!-- METASCHEMA MODULE oscal_component_metaschema.xml-->
<!-- order changes: -->
<xsl:template match="implemented-requirement">
Expand All @@ -69,16 +103,21 @@
<xsl:apply-templates select="remarks"/>
</xsl:copy>
</xsl:template>

<!-- METASCHEMA MODULE oscal_implementation-common_metaschema.xml-->
<!-- 'BY_KEY' is now 'ARRAY'; 'NCName' is now 'token' - no syntax change in XML -->

<!-- METASCHEMA MODULE oscal_assessment-plan_metaschema.xml-->
<!-- 'BY_KEY' is now 'ARRAY' -->

<!-- METASCHEMA MODULE oscal_assessment-results_metaschema.xml-->
<!-- 'BY_KEY' is now 'ARRAY' -->

<!-- METASCHEMA MODULE oscal_assessment-common_metaschema.xml-->
<xsl:template match="subject-placeholder">
<xsl:message>'subject-placeholder' element is dropped from data in conversion (as it is no longer supported in OSCAL).</xsl:message>
</xsl:template>

<!-- object select-subject-by-id has names in use 'include-subject' and 'exclude-subject'-->
<xsl:template match="include-subject/@uuid-ref | exclude-subject/@uuid-ref">
<xsl:attribute name="subject-uuid" select="string(.)"/>
Expand All @@ -93,6 +132,7 @@
<xsl:message expand-text="true">'{name(..)}' type must be defined: please provide a type for
{ name(..) } '{ @uuid-ref }'.</xsl:message>
</xsl:template>

<!-- METASCHEMA MODULE metaschema/oscal_poam_metaschema.xml-->
<!-- 'BY_KEY' is now 'ARRAY' -->
</xsl:stylesheet>

0 comments on commit 5b2d93e

Please sign in to comment.