Sign In/My Account | View Cart  
advertisement

Article:
 Combining RELAX NG and Schematron
Subject: Combining schema languages
Date: 2004-02-17 13:40:06
From: Mark Seaborne

Interesting article, thanks.


I wonder if you have looked at all at how you can achieve pretty much the same results you have with Relax NG + Schematron, but with WXS + XForms Model.


The XForms model, among other things, can be used to define XPath based constraints on an XML instance (including equivalent to the document() function), combined with a WXS schema.


You could even use XForms + XHTML + CSS as a dynamic report on the validity of a particular instance if you so wished.


I remember thinking the first time I looked at the XForms model that it does pretty much the same job as Schematron, and wondered why the authors hadn't just used Schematron, instead of coming up with their own syntax.


Never mind, it does a job that you have demonstrated to be very useful.


All the best


Mark Seaborne


Previous Message Previous Message   Next Message No Next Message


Titles Only Titles Only Newest First
  • Combining schema languages
    2004-02-23 11:38:43 Eddie Robertsson

    Hi Mark,


    I haven't looked at XForms but I have played around with WXS and Schematron. It works pretty much the same as Relax NG and Schematron and the two differences are:


    1) The Schematron declarations are embedded within the xs:appinfo element.


    2) You use a different extractor stylesheet to extract the Schmematron declarations (XSD2Schtrn.xsl). The stylesheet is available here:
    http://www.topologi.com/public/Schtrn_XSD/XSD2Schtrn.zip

    • Combining schema languages
      2004-02-27 05:47:18 Mark Seaborne

      Eddie,


      Okay, that's an interesting approach.


      If you used XForms you leave the schema alone, but reference it in an XForms model:


      <xfm:model id="myModel" schema="mySchema.xsd">


      You then define Model Item Properties that add additional constraints:


      <xfm:bind nodeset="purchaseOrder/items/item" constraint="number(price) * number(quantity) = number(totalAmount)"/>


      In addition to constraint, you can use "calculate", "relevant", "required", "readonly", "type" (apply a WXS type) and "p3ptype"


      XForms' instance() function allows you to define MIPs that involve multiple XML instances, if you so wish.


      I quite like the fact that the XForms model is non-intrusive, allowing you to build on a schema without needing read access to the schema.


      However you do it though, it is undoubtedly useful to be able to express


      All the best


      Mark





Sponsored By: