xlst template for simulink xml parsing
Show older comments
i'm trying to export a simulink webview (without the use of the report generator toolbox).
My thought was to convert the .slx file to .xml in matlab, then in python parse the .xml to .html.
this is my matlab code:
load_system('scSam') %scSam is the .slx model, mind it's just a dummy with some random blocks thrown in
save_system('xmltest', 'model_xml.xml','ExportToXML', true);
once i have the xml file, i parse it in python:
import lxml.html
from lxml import etree
xslt_doc = etree.parse("test-xslt.xslt") %this is the xslt template i'm using
xslt_transformer = etree.XSLT(xslt_doc)
source_doc = etree.parse("xmltest.xml")
output_doc = xslt_transformer(source_doc)
output_doc.write("htmltest.html", pretty_print=True)
my issue is that i cannot find or write a decent xlst stylesheet able to actually reproduce the simulink file.
I'm glad to hear some suggestions from you. Maybe this approach is overcomplicating things, or mabe there is a public simulink xlst file i don't know about. Or mabe this jsut can't be done withtout the toolbox
Edit: i'm thinking of doing the latter conversion part in Java, is it a good idea? i'm not really familiar with it other than the basics but i know it has some good xml libraries
Accepted Answer
More Answers (0)
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!