Skip to content

Commit

Permalink
Try lifting import and variable, debug more.
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-stein-nist committed Jan 17, 2023
1 parent f9571d6 commit 31093a8
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions toolchains/xslt-M4/schema-gen/make-json-schema-metamap.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,28 @@
<xsl:strip-space elements="METASCHEMA define-assembly define-field model"/>

<xsl:output indent="yes" method="xml"/>


<xsl:import href="../nist-metaschema-COMPOSE.xsl"/>

<!-- This parameter controls whether this transform will compose the source metaschema as part of running this
stylesheet in standalone mode for debugging. In the CI and CD pipelines for production, this is unusual and
not desired, so this parameter is not enabled by default and set to false(). For unit testing and local debug
scenarios, you will want this so you do not save intermediate "composed" metaschemas needed for JSON Schema
generation, so with Oxygen, Saxon on the CLI, or Saxon via API you would set this to `true()`. -->
<xsl:param name="compose-metaschema-first" select="true()"/>
<xsl:variable name="composed-metaschema" select="if ($compose-metaschema-first) then nm:compose-metaschema(/) else /" />

<xsl:template match="/" priority="2">
<xsl:choose>
<xsl:when test="$compose-metaschema-first = true()">
<xsl:sequence select="nm:compose-metaschema(/)"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates />
</xsl:template>

<xsl:variable name="home" select="/"/>

<xsl:variable name="string-value-label">STRVALUE</xsl:variable>
<xsl:variable name="markdown-value-label">RICHTEXT</xsl:variable>
<xsl:variable name="markdown-multiline-label">PROSE</xsl:variable>

<xsl:key name="assembly-definition-by-name" match="METASCHEMA/define-assembly" use="@_key-name"/>
<xsl:key name="field-definition-by-name" match="METASCHEMA/define-field" use="@_key-name"/>
<xsl:key name="flag-definition-by-name" match="METASCHEMA/define-flag" use="@_key-name"/>

<xsl:import href="../nist-metaschema-COMPOSE.xsl"/>

<xsl:variable name="composed-metaschema" select="/"/>
<xsl:key name="flag-definition-by-name" match="METASCHEMA/define-flag" use="@_key-name"/>

<xsl:template match="/METASCHEMA" expand-text="true">
<map>
Expand Down

0 comments on commit 31093a8

Please sign in to comment.