Re: An experiment with xsl
| From: | Manuel Lemos | Date: | Wed, 08 Sep 2004 22:54:41 +0000 |
| Subject: | Re: An experiment with xsl | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14464@lists.php.net to get a copy of this message | ||
On 09/08/2004 06:44 PM, J llarens wrote:
Since almost 1 year Im reading about the use of xml in design and coding phases. But my only source of info is internet because here the good books regarding IT are very expensive. 3W could give me a lot of info, but, in conjunction, fragmented and sometimes contradictory. Few months ago I discover the xslt plugins inside Dia, and voila! the plugins/xslt directory have a working and traceable set of examples of xml and xslt for code generation. Messing and mixing with the examples I can produce this xsl's (attached in this mail): dia-uml to PEAR DB_DataObject .ini files and .php table object (not including relationships) dia-uml to HTML form for record editing dia-uml to MySQL database definition To get the results whitout using dia I use this at commandline: xsltproc /usr/share/dia/plugins/xslt/dia-uml.xsl osdata.dia > osdata.xml to get the pear clases and .ini file: xsltproc /usr/share/dia/plugins/xslt/dia-dbo.xsl osdata.xml to get the html form: xsltproc /usr/share/dia/plugins/xslt/dia-html-edit.xsl osdata.xml to get the MySQL data definition: xsltproc /usr/share/dia/plugins/xslt/dia-sql.xsl osdata.xml ROCKS! But still there are some things that Im unable to achieve: I cant see how to include relationships (foreign key -> primary key), I dont see the data about the relationships in the created osdata.xml, the dia-uml.xsl simply dont take it in account. I dont know how to implement some 'extra stuff' like labels to use instead of fieldnames in HTML forms. I think that operations tab in properties of a class is the right place to put things like labels and sizes etc but Im not sure and I suppose there is a standard procedure to follow, but I did not found it. My ultimate (and long-term, sigh) goal is to build a PHP application (well... most part of the application at less) simply translating an UML model. Someone have that missing info or can guide to a related resource?This has really not to do with PEAR, but since it has all to do with what you are talking about, you may be interested. Metastorage is a Data Access Object (DAO) class code generator tool . It lets you design your DAO class model in a simple XML format to specify the class variables, relationships between classes, validation rules and functions of code for manipulating the DAO as your application needs. Currently there is a developer working on a conversion tool that lets you take a XMI file and convert it to the Metastorage format. XMI is a XML format defined by OMG to store export definitions of UML artifacts. This tool converts XMI class diagrams to Metastorage format using XSLT. There is a lot more to say about this tool, but this should give you an idea. Metastorage generates DAO classes in PHP and also the necessary support database schema in Metabase format and an installation class. This is the same format used by PEAR::MDB because MDB itself is based on Metabase. You may learn more about this here: http://www.meta-language.net/metastorage.html http://www.meta-language.net/screenshots.html Feel free to mail me back or join the development mailing list where you may also find the developer of the XMI to Metastorage conversion tool. http://groups.yahoo.com/group/metal-dev/ PS. Dia is not an appropriate tool for designing with UML. If you are using Linux, you may want to try Umbrello instead. This is the base tool that is generating the XMI files for testing the conversion tool. http://www.umbrello.org/ There are other commercial and Open Source UML tools like ArgoUML. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html