transformation of UML Diagrams to specification Z using xsl transformation
开发者_JS百科I'm trying to transform some uml diagrams (of singleton , AbstractFactory ...) to Z specification , first i transformed my uml diagram to an xml file using starUML then i used an xsl program and saxon to transform my xml file to .tex( for Z ) , but it didnt work . if someone has an idea about how the xsl program should be written (just maybe the steps) that will be great.
thanks
I would say, this is a generally a very bad idea. There are many different formats for storing UML. XMI is a standard, however there are afaik at least three different versions and they are quite complex. Transforming XML to TeX using XSLT must be as well quite a big hurdle, especially when you are trying to get Z specifications, which are afaik functional and procedural and UML is based on object oriented programming. I think they might be a better way to achieve what you want. Take for example Maude for Eclipse, which can generate Maude specifications (algebraic data type specifications) from EMF (Eclipse Modeling Framework) based models, which can be also UML2 as found in Eclipse tools.
Instead of trying to write a XSLT transformation, it would be much better to write a model to text transformation. Given the UML model represented as an instance of the UML metamodel (kind of a AST) you could write an Model to text transformation that traverses the UML model and generates the corresponding text. There are several Eclipse projects for this.
Another solution (neater but also more complex) would be to define the metamodel of Z and write a model to model transformation between both metamodels.
精彩评论