Skip to content

Commit

Permalink
adding missing metaschema composition transform. This was removed in …
Browse files Browse the repository at this point in the history
…the cleanup by accident.
  • Loading branch information
david-waltermire committed Aug 27, 2021
1 parent fc9fd6d commit 25a56e7
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions toolchains/xslt-M4/compose/reduce-map.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xpath-default-namespace="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
xmlns:html="http://www.w3.org/1999/xhtml"

exclude-result-prefixes="#all"
version="3.0">

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

<xsl:template match="@group-name | @group-xml| @link | @root-name | @use-name"/>

<xsl:template match="formal-name | description | remarks"/>

<xsl:template match="/map">
<model root-at="{*/@root-name}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</model>
</xsl:template>

<xsl:template match="@name">
<xsl:copy-of select="."/>
<xsl:if test="empty(../parent::group)">
<xsl:attribute name="key" select="(../@root-name,../@use-name,.)[1]"/>
</xsl:if>
<!--<xsl:if test="not(../@in-xml=('UNWRAPPED','HIDDEN'))">
<xsl:attribute name="gi" select="(../@root-name,../@use-name,.)[1]"/>
</xsl:if>-->
</xsl:template>

<xsl:template match="@required"/>

<xsl:template match="@max-occurs">
<!--<xsl:attribute name="occurs" select="(../@min-occurs,.) => string-join(' ')"/>-->
</xsl:template>

<xsl:template match="@min-occurs"/>

<!--<xsl:template match="@min-occurs[empty(../@max-occurs)]">
<xsl:attribute name="occurs" select="(.,'1') => string-join(' ')"/>
</xsl:template>-->

</xsl:stylesheet>

0 comments on commit 25a56e7

Please sign in to comment.