cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [Announcement] XMLForm 0.8.2 released
Date Thu, 16 May 2002 09:49:21 GMT


I am having problems writing Schematron rules for multiple-select widgets.  For
example, imagine you have an <xf:selectMany ref="/color"> widget which presents
as a set of four checkboxes whose captions are "red", "blue", "green", and "
yellow".  You want to write two validation rules 1) At least one color must be
selected and 2) No more than two colors may be selected.

The only way that seems to work is:
      <rule context="/">
            <assert test="color[1]='red' or color[1]='blue' or color[1]='green'
or color[1]='yellow'">
                  At least one color must be selected.
      <rule context="/">
            <assert test="color[3]=''">No more than two colors may be

(Hereafter "global violation set" refers to the <violation ref=...> tags
generated whenever a <violations/> element is *outside* of an xf widget; "local
violation set" refers to the <violation> tags generated whenever a <violations/>
element is *inside* of an xf widget.)

      1)  the context of these rules is "/", so @ref in global violation set is
      2)  violations appear only in the global violations set and *not*  in the
local violations set within the <xf:selectMany>.  There seems to be a problem in, startElementViolations method.  This line:
      if ( !currentRef.equals (nextViolation.getPath () ) ) break
is intended to insure that only <violation> elements matching the containing
context element are generated.  However in the case of the example given above,

This is only a problem with <xf:selectMany>.  All other xf widgets correctly
generate violations in both the global violation set and the local violation

Is there some better way to write these rules?

Is there a problem with the way selectMany is put on the Entry stack?  Or is it
the value getPath() is returning?

Is there a compelling reason to use a SortedSet for violations?  (cursory
examination of code suggests "yes", but...).  Global violations end up sorted
alphabetically.  Makes it difficult to display them in document order (the
"natural" order IMHO).

Do you plan to support Schematron <report> element?  Would make it easier to
write rules like "/foo is invalid if it contains any of the following
characters: #, &, *, %",  or "/foo may contain only digits 0-9 and decimal

Is there any way to implement Schematron <name> and <value-of> elements?  Since
XMLForm validates against instance data rather than the entire form description,
I don't see how it can retrieve this sort of context.  Still, it would be nice
to be able to write rules like this:
      <name ref="../xf:caption> cannot contain <value-of select
to produce a violation like this:
      "Street Name cannot contain a "$"


To unsubscribe, e-mail:
For additional commands, email:

View raw message