GNOME Bugzilla – Bug 155255
Some additions and fixes to xsl stylesheets
Last modified: 2005-10-08 19:42:00 UTC
I have over the last couple of months created some new style sheets and corrected one of the existing ones. Specifically, I have removed the parse error from dia-uml2docbook.xsl, though I am not sure who would use it. In addition, I have written two new xsl style sheets. First is one I called dia-uml2uml.xsl. This simply dumps the output of dia- uml.xsl to the .code file so it could be inspected (maybe there was a better way but this is what I came up with. Second, a file called dia-uml2cpp.xsl. I created a new file because I intended to radically change the way c++ code was being generated. There were some things being done in dia-uml2c++.xsl that I was not sure were correct usage of UML and I knew were not correctly being generated, but I did not want to break anything for those who may have been using it. My xsl properly handles generalization, association and dependencies as well as templates. Ok, I may have a few bugs in my version as well but I have not yet found them. Finally, I had to enhance dia-uml.xsl to output the associations, generalizations and dependencies. I also added the dia ID as an attribute to all the elements. I have tested these changes with the other xsl sheets and did not find any incompatibilities and of course to support the two new style sheets, I have modified the stylesheets.xml file to add the selections for "cpp" and "UML". I can provide these files to the development community if some one will contact me, I don't want to clutter Bugzilla with all the contents.
Created attachment 32540 [details] corrected version of dia-uml2docbook.xsl Fixed the parse error
Created attachment 32541 [details] Enhanced stylesheet This style sheet adds the id attribute to all element nodes and adds the nodes for generalization, association and dependancy. Associations include the bind stereotype where appropriate.
Created attachment 32542 [details] dia-uml to cpp headers and source files This version is radically different from the c++ translation provided by dia-uml2c++.xsl. So different that I did not want to replace the old one so I wrote a new one based on the original. This one handles associataions, generalization, dependancies, parameterized classes and instantiations of paramameterized classes as well as generating header(.h) and source(.cpp)files. Class diagrams with spaces in the names are translated into somewhat legal c++ names and more.
Created attachment 32543 [details] xlated dia diagram dump style sheet simply sends the output from dia-uml.xsl to the .code file.
Created attachment 32544 [details] The stylesheet xml file that ties it all together an update of the xml file that ties it all together.
Created attachment 32709 [details] Correction to the earlier submitted version of uml to cpp I found I had sent the wrong version of this file earlier. That version incorrectly applied the static keyword to function definitions and had an extra white space in front of functions with no return type.
If there would be a diff (produced by diff -u) I'll probably review and commit. Please attach (and mark!) the file as text to make the review process less tedious. Thanks, Hans
Created attachment 33508 [details] diff -u of the style sheet changes for Hans Here is the diff -u output so Hans can see the differences from the CVS.
Created attachment 33509 [details] diff -u output for dia-uml.xsl The diff -u output for the file dia-uml.xsl for hans
Created attachment 33510 [details] [review] Patch file for the two xls file that changed I now know how to make a patch file, so here is a patch file for the xlst directory based on my xls changes. The patch tool I use does not seem to be able to create new files so don't forget to add dia-uml2uml.xls and dia-uml2cpp.xls after the patch.
I noticed that dia-uml2docbook.xls was obsolete. That is it is no longer in the CVS so I withdrew it.
There is a lot of white space changes in the file. Could you either do your changes without reformating the whole file or at least try diff with the --ignore-space-change option ? Otherwise it is very difficult to see what exactly was changed. I also noticed your xml tool removed the original comment from the end of the file. Was this on purpose ?
If there are any other options you need to be able to be able to approve the changes could you please let me know before I make the diffs? The reason that there are so many changes to the file is also due to the number of changes I have made and added to original the dia-uml.xsl. I have also compared the output for each of the original transforms using as many examples as I could find to ensure that the output does not "break" any existing tranformations. Contrary to the text in the trailing comment, the trailing comment is not processed by any of the xml or xsl transforms and therefore not used by any of them so are useless and I don't bother to keep them.
Created attachment 35224 [details] [review] Removed whitespace changes from dia2UML.xsl Since the original version of the changes to the file dia-uml.xsl contain many unneeded whitespace changes, it was difficult at best to determine the relevant code changes. This patch was created after painstakingly removing all whitespace only changes. It should now be easier to validate against the original dia-uml.xsl tranform.
Sorry for not getting back earlier. [I was quite drained from other projects.] The patch is now applied to cvs: 2004-01-28 Hans Breuer <hans@breuer.org> [Extented version for UML to C++ conversion by Dave Klotzbach, bug #155255] * plug-ins/xslt/dia-uml2cpp.xsl : (new file) ... handles associataions, generalization, dependancies, parameterized classes ... * plug-ins/xslt/styleshetts.xml : refernce it * plug-ins/xslt/dia-uml.xsl : handle more UML types uesd above
Adjusting target to help finding 0.94 dups already fixed