Author Topic: XSLT of a Diagram to obtain a file which is not an XML  (Read 1938 times)

pablo.ruiz

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
XSLT of a Diagram to obtain a file which is not an XML
« on: April 29, 2021, 09:44:02 pm »

What we want to achieve:
We have some diagrams and we would like obtain a .json configuration files for our process. At the moment, we’re using an external python script to export the XML diagrams using the Project Class function ExportPackageXMI. Then we do the XSLT with lxml. But we would like to achieve this behaviour using the EA tools to ease the distribution.

What have we have tried or considered:

Publishing a Package as XMI providing a stylesheet

I’ve tried to publish a package with a stylesheet but it doesn’t work if it doesn’t produce a valid XML file. If the XSL doesn’t produce and XMIL file, the output file is blank. I made a Bug Report for this issue, but I thought it would be interesting to share it here too.

Creating an Add-In

We have not work on this direction, because it’s a bit inconvenient to distribute the Add-in and we would prefer to have built-in solution.

Adding an Export Script  to our MDG technology

So I’ve followed these steps:

https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/add_import_export_scripts.html

After importing the MDG, the script is present in MDG Technologies/Model Technologies/Example/Scripts/xmi2json.
 
But I don’t know how I’m supposed to execute the Export script.


Additional information:
EA version 15.2.1555


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: XSLT of a Diagram to obtain a file which is not an XML
« Reply #1 on: April 29, 2021, 10:01:09 pm »
I think those are meant to be called from the Specialize | Technologies menu, similar to Niem, but I'm not sure about that. I've never really used these myself.

An alternative would be write a regular script. I think (I'm sure really) it's would be much easier to use the API to create your JSON instead of writing a transformation on top of XMI (ugh :()

I wrote a JSON Schema export add-in myself.

Geert