How can I convert an openEHR template to HTML using python without XSL?

184 Views Asked by At

I want to generate HTML form using openEHR OPT Templates. A template generally looks like this (sample OPT file)

It is like an XML of some form I guess with some extra information and I want to convert it to HTML using python but I don't have an XSL file. I do have the XSD which I am using for validation later using lxml but I don't think it can help in the conversion. There are many different types of templates, so is there a way I can do it? Any help is appreciated.

2

There are 2 best solutions below

0
On

I would say you can go either the XSLT way for generating your transformation or trying to use the existing python openEHR lib https://github.com/crs4/pyEHR, but I'm not sure if they support OPT

0
On

You can write your own HTML from the metadata in the OPT, but you need to understand the OPT model, archetype model and openEHR RM before!

Then the rest is just traversing the XML tree, reading the metadata from there and mapping to HTML tags.

This project, though it's in Groovy, can give you an idea on the logic, because it has an HTML form generator, pretty basic, nothing fancy, code is still big to paste it here: https://github.com/ppazos/openEHR-OPT