-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnist-metaschema-MAKE-JSON-SCHEMA-as-xml.xsl
46 lines (36 loc) · 2.78 KB
/
nist-metaschema-MAKE-JSON-SCHEMA-as-xml.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:nm="http://csrc.nist.gov/ns/metaschema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all">
<!-- Purpose: Produce a JSON Schema reflecting constraints defined in a metaschema -->
<!-- Dependencies: This is a 'shell' XSLT and calls several steps in sequence, each implemented as an XSLT -->
<!-- Input: A top-level metaschema; this XSLT also composes metaschema input so composition is not necessary -->
<!-- Output: A JSON Schema (v7) describing a JSON format consistent with definitions given in the input metaschema -->
<!-- Note: This XSLT uses the transform() function to execute a series of transformations (referenced out of line) over its input -->
<!-- Debug variant writes out JSON Schema as XPath XML subject to validation -->
<!-- Check its fitness for serialization by validating against XSD ../../support/xml/xpath-json.xsd -->
<xsl:output method="xml" indent="yes"/>
<!-- Turning $trace to 'on' will
- emit runtime messages with each transformation, and
- retain nm:ERROR and nm:WARNING messages in results. -->
<xsl:param name="trace" as="xs:string">off</xsl:param>
<xsl:variable name="louder" select="$trace = 'on'"/>
<xsl:variable name="xslt-base" select="document('')/document-uri()"/>
<xsl:import href="../common/nist-metaschema-metaprocess.xsl"/>
<!-- The $transformation-sequence declares transformations to be applied in order. -->
<xsl:variable name="transformation-sequence" expand-text="true">
<xsl:variable as="xs:string" name="composer-dir">../compose</xsl:variable>
<nm:transform version="3.0">{ $composer-dir }/metaschema-collect.xsl</nm:transform>
<nm:transform version="3.0">{ $composer-dir }/metaschema-build-refs.xsl</nm:transform>
<nm:transform version="3.0">{ $composer-dir }/metaschema-trim-extra-modules.xsl</nm:transform>
<nm:transform version="3.0">{ $composer-dir }/metaschema-prune-unused-definitions.xsl</nm:transform>
<nm:transform version="3.0">{ $composer-dir }/metaschema-resolve-use-names.xsl</nm:transform>
<nm:transform version="3.0">{ $composer-dir }/metaschema-resolve-sibling-names.xsl</nm:transform>
<nm:transform version="3.0">{ $composer-dir }/metaschema-digest.xsl</nm:transform>
<nm:transform version="3.0">{ $composer-dir }/annotate-composition.xsl</nm:transform>
<nm:transform version="3.0">JSON-schema/make-json-schema-metamap.xsl</nm:transform>
<!--<nm:transform version="3.0">util/xpath-json-to-json.xsl</nm:transform>-->
</xsl:variable>
</xsl:stylesheet>