Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7ab05ce
Added lutaml_xsd command for XSD processing
Jul 15, 2025
55cb373
fixed rubocop warnings
Jul 16, 2025
784995a
updated preprocessor classes and specs
Jul 16, 2025
1824275
minor: class name update
Jul 17, 2025
8ba25e7
code refactoring and Copilot comments implementation
Jul 17, 2025
366a22c
Added 'used_by' liquid filter and spec
Jul 18, 2025
ec3aaca
Added lutaml-model branch in Gemfile
Jul 18, 2025
956a2ee
added expressir branch in Gemfile
Jul 21, 2025
b1985fb
fixed failing specs
Aug 18, 2025
2154232
removed expressir gem
Aug 18, 2025
cb8bdc9
updated lutaml-model branch
Nov 5, 2025
ed894fb
added Liquid filter methods for Unitsml template
Jul 25, 2025
d657456
updated template helper methods
Jul 28, 2025
b020a0f
updated conversion methods
Aug 15, 2025
6ce16af
minor refactoring
Aug 15, 2025
6943285
Updated conversion methods and added specs of UnitsML schema
Aug 18, 2025
76405a6
fixed failing specs
Aug 19, 2025
6887957
fixed failing spec
Aug 19, 2025
3defd74
implemented rubocop changes and fixed failing specs
Aug 20, 2025
d42af02
fixed xsd failing spec
Aug 20, 2025
959f2ce
removed hand crafted xml
Aug 29, 2025
9442c45
removed handcrafted XML, and updated specs and methods
Sep 1, 2025
ec03e53
removed unused filters
Oct 6, 2025
a41e0b8
updated filters module methods
Oct 7, 2025
f463fc7
implemented xsd direct block support
Oct 8, 2025
85c7d86
Updated local file system use and XSD template option support
Oct 9, 2025
e7d8cbb
Updated XSD preprocessor methods and filter method
Oct 10, 2025
dee3614
fixed lutaml-model gem duplication
Nov 5, 2025
69d1aaa
Updated specs and processing methods
Nov 7, 2025
b7eff81
Updated supported option name, metanorma-utils gem branch name
Nov 10, 2025
8f38370
fixing failing spec
Nov 12, 2025
02132a2
testing canon gem
Nov 13, 2025
cd689fb
freezed canon version to 0.1.3
Nov 14, 2025
78ab111
Migrate lutaml_xsd to lutaml-model parser
May 7, 2026
215454b
Pin XSD dependency branches for CI
May 7, 2026
1fd40b2
Merge XSD parser branch into UnitsML filters
May 7, 2026
6d57f7f
Use compatible standoc constraint for XSD CI
May 7, 2026
1385950
Use lutaml-model XSD parser for schema preprocessing
May 8, 2026
28c4451
ci: rerun xsd dependency checks
May 8, 2026
8f4585c
Merge XSD parser branch into UnitsML filters
May 11, 2026
615fc9c
Restore XSD paragraph rendering contract
May 11, 2026
47b7975
Use metanorma main for XSD dependency
May 11, 2026
4726d09
Merge latest XSD parser updates into UnitsML filters
May 11, 2026
226f21c
Use merged lutaml XSD parser
May 12, 2026
be0c072
Merge branch 'feature/lutaml_xsd_command' into feature/unitsml_liquid…
May 12, 2026
7a835db
Merge remote-tracking branch 'origin/main' into feature/lutaml_xsd_co…
May 12, 2026
bc27f74
Merge branch 'feature/lutaml_xsd_command' into feature/unitsml_liquid…
May 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ rescue StandardError
nil
end

gem "lutaml", github: "lutaml/lutaml", branch: "main"
gem "lutaml-model", github: "lutaml/lutaml-model", branch: "fix/xsd-target-namespace-prefix"
gem "rake", "~> 13"
gem "rspec"
gem "rspec-html-matchers"
Expand Down
3 changes: 3 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ within a Metanorma document:
* Enterprise Architect exported UML files in XMI format (`*.xmi`)
* LutaML GML Dictionary files (`*.xml`)
* JSON or YAML files (`*.json|*.yml|*.yaml`)
* XML Schema files (`*.xsd`)

== Installation

Expand All @@ -34,6 +35,8 @@ link:docs/usages/lutaml-gml.adoc[Usage with LutaML GML Dictionary by lutaml_gml_

link:docs/usages/json_yaml.adoc[Usage with JSON or YAML files by data2text, yaml2text or json2text]

link:docs/usages/lutaml-xsd.adoc[Usage with XML Schema files by lutaml_xsd]

== Documentation

Please refer to https://www.metanorma.org.
Expand Down
94 changes: 94 additions & 0 deletions docs/usages/lutaml-xsd.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
== Usage with LutaML XSD

=== Overview

The `lutaml_xsd` macro parses *XML Schema (XSD)* files through `lutaml-model`
and exposes the parsed schema object to *Liquid* templates.

=== Syntax

[source,adoc]
-----
[lutaml_xsd,<path_to_xsd>,<context_name>[, option1=value1, option2=value2, ...]]
----
<your Liquid template here>
----
-----

* `<path_to_xsd>`: Path to the XSD file to be processed.
* `<context_name>`: The name of the context variable to use in the template.
* `option1=value1, ...`: Optional parameters (<<options,supported options>>).

[[options]]
=== Options

* `location`: Base URL or path for resolving `<xs:import>` and `<xs:include>`
statements in the XSD. When omitted, the directory of `<path_to_xsd>` is used.

=== Liquid Template Context

The context variable (e.g., `unitsml`) exposes the parsed
`Lutaml::Xml::Schema::Xsd::Schema` object through its Liquid drop.

Commonly used schema collections:

* `element`: List of elements defined in the XSD.
* `complex_type`: List of complex types defined in the XSD.
* `simple_type`, `attribute`, `attribute_group`, `group`, `import`, and
`include`: Other schema components exposed by `lutaml-model`.

Commonly used helpers:

* `elements_sorted_by_name`, `complex_types_sorted_by_name`,
`attribute_groups_sorted_by_name`: Sorted schema collections.
* `used_by`, `child_elements`, `attribute_elements`, and `referenced_type`:
Component helpers exposed by parsed XSD objects.

=== Example: Listing Elements and Complex Types

[source,adoc]
-----
= Elements
[lutaml_xsd,path/to/unitsml.xsd,unitsml]
----
{% for element in unitsml.elements_sorted_by_name %}
Name: *{{ element.name }}*
Type: *{{ element.type }}*
Used by: {{ element.used_by | map: "name" | join: ", " }}
{% endfor %}
----

= ComplexTypes
[lutaml_xsd,path/to/unitsml.xsd,unitsml]
----
{% for complex_type in unitsml.complex_types_sorted_by_name %}
Name: *{{ complex_type.name }}*
Children: {{ complex_type.child_elements | map: "name" | join: ", " }}
Attributes: {{ complex_type.attribute_elements | map: "name" | join: ", " }}
{% endfor %}
----
-----

=== Example: Using with Remote XSD and Options

[source,adoc]
-----
[lutaml_xsd,path/to/omml.xsd,omml, location=https://raw.githubusercontent.com/t-yuki/ooxml-xsd/refs/heads/master]
----
{% for element in omml.element %}
Name: *{{ element.name }}*
Type: *{{ element.type }}*
{% endfor %}
----
-----

=== Use Cases

* Generate documentation for XML schemas.
* Extract and list schema elements and types or other details.
* Customize output using Liquid templates.

=== Notes

* The macro supports local files at `<path_to_xsd>`.
* You can use all standard *Liquid* template features for formatting and logic.
2 changes: 2 additions & 0 deletions lib/metanorma-plugin-lutaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
require "metanorma/plugin/lutaml/json2_text_preprocessor"
require "metanorma/plugin/lutaml/yaml2_text_preprocessor"
require "metanorma/plugin/lutaml/data2_text_preprocessor"
require "metanorma/plugin/lutaml/base_preprocessor"
require "metanorma/plugin/lutaml/lutaml_preprocessor"
require "metanorma/plugin/lutaml/lutaml_xsd_preprocessor"
require "metanorma/plugin/lutaml/lutaml_uml_datamodel_description_preprocessor"
require "metanorma/plugin/lutaml/lutaml_ea_xmi_preprocessor"
require "metanorma/plugin/lutaml/lutaml_xmi_uml_preprocessor"
Expand Down
Loading
Loading