From 0a214b8c0bf8b06f6b85926d3a259f1a1b72c39b Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Fri, 27 Mar 2020 17:26:21 -0400 Subject: [PATCH] Further implementation, worked example --- .../worked-example/everything_metaschema.xml | 12 +-- test-suite/worked-example/kitchen-drawer.xml | 2 +- .../schema_gen/make-metaschema-metatron.xsl | 99 ++++++++++++++----- 3 files changed, 84 insertions(+), 29 deletions(-) diff --git a/test-suite/worked-example/everything_metaschema.xml b/test-suite/worked-example/everything_metaschema.xml index f4c7626b5..7a9574038 100644 --- a/test-suite/worked-example/everything_metaschema.xml +++ b/test-suite/worked-example/everything_metaschema.xml @@ -209,13 +209,13 @@ Under 'widget' - + - + - + @@ -237,17 +237,17 @@ Under 'widget' - + start end - + - + diff --git a/test-suite/worked-example/kitchen-drawer.xml b/test-suite/worked-example/kitchen-drawer.xml index f87a9e5bc..22aff9c85 100644 --- a/test-suite/worked-example/kitchen-drawer.xml +++ b/test-suite/worked-example/kitchen-drawer.xml @@ -27,7 +27,7 @@ 'Twas brilling, and the slithy toves - Did gyre and gimble in the wabe: + All mimsy were the borogoves, And the mome raths outgrabe. diff --git a/toolchains/xslt-proto-v04/schema_gen/make-metaschema-metatron.xsl b/toolchains/xslt-proto-v04/schema_gen/make-metaschema-metatron.xsl index cbca3bf0f..16dd091ea 100644 --- a/toolchains/xslt-proto-v04/schema_gen/make-metaschema-metatron.xsl +++ b/toolchains/xslt-proto-v04/schema_gen/make-metaschema-metatron.xsl @@ -64,13 +64,19 @@ - + - - - + + + + + + + + + @@ -82,7 +88,6 @@ / is expected to occur at most - @@ -92,9 +97,7 @@ not({ $condition }) or - / is expected to occur at least - + / is expected to occur at least @@ -103,14 +106,15 @@ not({ $condition }) or - - / is expected to occur exactly - + count({ $target }) eq { (@min-occurs cast as xs:integer) } + + + / is expected to occur exactly - + + @@ -121,13 +125,13 @@ not({ m:condition(parent::matches) }) or - - / '' is expected to match - regular expression '' + matches( { $target }, '{ . }') + + / '' is expected to match regular expression '' + @@ -136,12 +140,57 @@ not({ m:condition(.) }) or - - / - '' is expected - to be one of + + { m:target(.) } = ( { $value-sequence } + + + + / '' is expected to be one of + + + yes + + + + + + + + + + + + + + { ancestor::*[exists(ancestor-or-self::constraint)] ! ' ' } + { m:condition(.) ! (' when ' || . || ', ') }allowed-values on { m:target(.) }: { string-join(enum/@value,', ' ) } + + + + + + { ancestor::*[exists(ancestor-or-self::constraint)] ! ' ' } + { m:condition(.) ! (' when ' || . || ', ') }{ m:target(.) } matches regex '{ @regex }' + + + + + + { ancestor::*[exists(ancestor-or-self::constraint)] ! ' ' } + { m:condition(.) ! (' when ' || . || ', ') }{ m:target(.) } has cardinality: { @min-occurs ! ( ' at least ' || (.,'0')[1]) } { @max-occurs ! ( ' at most ' || (.,'unbounded')[1]) } + + + + + + + + + @@ -191,6 +240,12 @@ + + + + + + @@ -200,6 +255,7 @@ + @@ -213,7 +269,6 @@ - { if ($count eq 1) then 'once' else ($count || ' times' ) }