[dsdl-discuss] Running on {empty} (was Re: Re: First draft of Schematron spec(Schematronin one defun))

From: Rick Jelliffe <ricko@topologi.com>
Date: Tue Jul 15 2003 - 14:51:20 UTC

From: "Eric van der Vlist" <vdv@dyomedea.com>

> This bigger picture makes Schematron enter the domain of "validation
> management". We could for instance imagine to accept a Relax NG binding
> and write stuff such as:
>
> <rule context="foo">
> <assert test="element bar{empty}">There should be an empty "bar"
> element here!</assert>
> </rule>
>
> Which would be shorter than writing the XPath expressions for checking
> than an empty "bar" element is available here...
>
> Would that make sense (I do think so)?

It is certainly possible, but I don't expect anyone would use RELAX NG:
because patterns and rules are too fine a grain, and phases are to coarse
a grain for handling inherited variants which a real check-in/check-out system
would need. It is something I have throught about, though not much, because
I don't want Schematron too grandiose: just a simple rule framework
with a little macro facility at the front end and a way to keep abreast
of fashions in query/transformation/addressing languages for XML is
all it needs!

For empty, the way I am hoping will find favour is this, using an abstract
pattern (you can do this using a pre-processor XSLT: I have one available):

<pattern is-a="empty-element">
    <param name="name" value="bar" />
</pattern>

where there is a library of abstract patterns. (A schema written in
terms of these patterns can be trivially converted to a grammar
or special-purpose validator, potentially avoiding the rigmarole of
XSLT.)

As an example, here is the abstract pattern for lists I have been working with :

<pattern is-a="list">
    <param name="container" value="sch:pattern" />
    <param name="items" value="sch:rule" />
    <param name="minimum" value="1" />
    <param name="maximum" value="'*'" />
    <param name="grouped" value="true" />
</pattern>

which means patterns contain 1 or more rules, and they
are all consecutive (not interleaved with other elements).

This kind of parameterized abstract pattern allows users to readily
*invent their own declarative schema languages*. They can
validate using Schematron, yet use the schema for other processes
which understand their type library. So you see why I have never
been so keen that Schematron must provide typing: you can
define your own type system* and facets (parameters)

The motivating example is the rhetorical schema: a schema
based on what the function of elements in an argument is.
We can have an abstract pattern called, for example,
topic.

<pattern is-a="topic">
    <param name="topic" value="table/caption" />
    <param name="container" value="../" />
</pattern>

<pattern is-a="topic">
    <param name="topic" value="div/h1" />
    <param name="container" value="../" />
</pattern>

<pattern is-a="topic">
    <param name="topic" value="bibref" />
    <param name="container" value="/bibliography/entry[@id=current()/refid]/title" />
</pattern>

<pattern is-a="topic">
    <param name="topic" value="/html:head/html:title" />
    <param name="container" value="/html:html/html/body" />
</pattern>

and so on, IYSWIM. Such a schema could be used for validation, but also
used by a smarter browser/aggregator to let the user navigate or summarize.

Cheers
Rick

* The type system must be flat, but an information item
can belong to more than one type if needed, and the schema
can itself be validated to check things like an element declared as
belonging to two incompatible types at the same time.

--
DSDL members discussion list
To unsubscribe, please send a message with the
command  "unsubscribe" to dsdl-discuss-request@dsdl.org
(mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)
Received on Tue Jul 15 16:44:26 2003

This archive was generated by hypermail 2.1.8 : Fri Dec 03 2004 - 14:00:27 UTC