OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML Schemas: Best Practices


Rick Jelliffe wrote:

That is an interesting paper.

I am surprised there is no treatment yet of the Extension framework that
Extensiblity developed. Also, Schematron does allow you to specify the
values of A and B, but in a separate section "diagnostics" which would
presumably appear in the appinfo for the top-level schema.

Yes, I've found the diagnostics functionality very useful since it allows you to use the very powerful value-of function in XSLT which means you can display just about anything you want (learning to master the diagnostic function probably take you another 30 min or so ;-)). Here's an example:

<sch:rule context="d:Demo">
   <sch:assert test="d:A > d:B" diagnostics="d1">Error!!!  A must be greater than B</sch:assert>

In the assert (or report) element you add the attribute diagnostics which is a reference to one or more diagnostic elements in a diagnostics section. In this case:

   <sch:diagnostic id="d1">Value of A is <sch:value-of select="d:A"/> and value of B is <sch:value-of select="d:B"/>.</sch:diagnostic>

Note, that the basic stylesheet (schematron-basic.xsl) doesn't support the diagnostics function however, it's easy to write your own stylesheet that extends skeleton1-5.xsl to support diagnostics [1].

[1] www.allette.com.au/Demo/XSD_Schtrn/schematron-basic-eddie.xsl

In order to use the diagnostics functionality you have to provide a command line argument diagnose=yes.