vb@0: include yslt.yml2
vb@0: 
vb@0: tstylesheet xmlns:uml="http://schema.omg.org/spec/UML/2.1",
vb@0:             xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" {
vb@0: 
vb@0:     template "/" apply "xmi:XMI/uml:Model/packagedElement", 0;
vb@0: 
vb@0:     template "packagedElement[@xmi:type='uml:Package']" {
vb@0:         param "name", "''";
vb@0:         if "$name=''"  apply "packagedElement", 0 { with "name", "@name"; }
vb@0:         if "$name!=''" apply "packagedElement", 0 { with "name", "concat($name, '_', @name)"; }
vb@0:     }
vb@0: 
vb@0:     template "packagedElement[@xmi:type='uml:Class']" {
vb@0:         param "name";
vb@0: 
vb@0:         | CREATE TABLE «$name»_«@name» (
vb@0:         apply "ownedAttribute";
vb@0:         | );
vb@0:     }
vb@0: 
vb@0:     template "ownedAttribute[@xmi:type='uml:Property' and type/@xmi:type='uml:PrimitiveType']" {
vb@0:         0> «@name»
vb@0:         choose {
vb@0:             when "type/@href='http://schema.omg.org/spec/UML/2.1/uml.xml#String'"
vb@0:                 >  VARCHAR
vb@0: 
vb@0:             // [...] for other types, extend when clauses
vb@0:         }
vb@0:         if "position()!=last()" > ,
vb@0:         text "\n";
vb@0:     }
vb@0: }
vb@0: