Derivation of complex types using a global and local schema file

Hi all,

I'm quite new to xml schema, especially to the area of overriding 
existing types (derivation, restriction, etc.). I have the following use 
case and I'd appreciate some input on the best way to model it in xml 
schema.

I have a template format in xml which is used to declare content using 
templates, lets say:

<page>
  <section template="intro">
     <input type="text" name="title">Welcome</input>
     <input type="longtext" name="body">Hello, welcome to the main 
page</input>
  </section>
  <section template="withpic">
     <input type="link name="picurl">http://.......</input>
     <input type="longtext" name="body">This is a wonderful picture</input>
  </section>
  <section template="withpic">
     <input type="link" name="picurl">http://.......</input>
     <input type="longtext" name="body">This is another picture</input>
     <input type="checkbox" name="position">left</input> <!-- optional, 
only values allowed left, right, center -->
  </section>
</page>

Now, there are two levels of declaration:
1) the basic elements page, section, input types  (link, longtext, 
checkbox...)
2) the sections depending on the value of the template attribute 
(withpic, intro), that restrict which input types can be used within 
this section.

I'd like to split both levels in different schema files, a global schema 
and a special schema, using the overriding mechanisms of xml schema 
(derivation, restriction, redefinition...). What is the best way to 
implement the overriding of the global schema by the local one?

Especially because the derivation depends on the attribute value 
(template=??) I am not sure how to implement this.

Thx for any hints or suggestions!

Nils

Received on Wednesday, 19 November 2008 12:12:39 UTC