I'm regularly creating an XSD schema by transforming a proprietary data model of a legacy system. This works out pretty good. However, the legacy system only allows me to specify very basic attributes of a parameter, such as the data type (int
, string
etc.).
I would like to enhance the XSL transformation with a mechanism that allows me to add meta data in order to provide more details for the transformation. I thought of something like the Java properties notation to assign attributes to an XPath.
Imagine the following example:
legacy system data model (acutally that neat, but suits best for demonstration purposes)
<datamodel>
<customer>
<firstName type="string"/>
<lastName type="string"/>
<age type="int">
<customer>
</datamodel>
meta data
customer/firstName/@nillable=false
customer/lastName/@nillable=false
customer/age/@nillable=true
customer/firstName/@minOccurs=1
customer/firstName/@maxOccurs=1
customer/lastName/@minOccurs=1
customer/lastName/@maxOccurs=1
resulting XSD schema
...
<xs:complexType name="customerType">
<xs:sequence>
<xs:element name="firstName" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="lastName" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="age" type="xs:int" nillable="true"/>
</xs:sequence>
</xs:complexType>
...
What do you think of that? Is there a way to include meta data into an XSL stylesheet?