I'm having a bit of difficulty figuring out exactly what you need; could
you explain the real constraint you're trying to add? In so far as I
think I understand, you want to apply a constraint to all elements that
belong to a specific attribute class; surely that would be simple to do
by specifying a context which filters them by the particular set of
attributes which are provided by that class?
<sch:rule context="tei:*[@myAtt1 and @myAtt2]">
On 2017-03-25 07:26 AM, Piotr Bański wrote:
> I'm sure everyone is dying to hear more about this, so here we go.
> I have now prepared a constraintSpec that silences the warnings (traced
> them to odds/extract-isosch.xsl in Stylesheets):
> <constraintSpec scheme="schematron" ident="die_bunny_die"
> <sch:rule context="*[@n]">
> <sch:report test="@n eq 'bunny'">whenever this rule is
> triggered, a cute little bunny dies...</sch:report>
> ... and I feel like a real monster now. I can kill bunnies just by
> pressing "Ctrl+V", anywhere in the tree...
> Do I think correctly that what I need is some clever way of saying
> something like "insert here the ident of the element which happens to be
> added to this class", and furthermore, that there is currently no way to
> do that?
> PS. Erratum: In my earlier message, I meant "root node" where I said
> "root element", and it wasn't relevant anyway...
> On 25/03/17 04:01, I wrote:
>> Hi again,
>> While compiling schemas for a modification that I'm working on, I can
>> see something like this:
>> [xslt] WARNING: constraint for att.referring class does not have a
>> context=. Resulting rule is applied to *all* elements.
>> Which is very true, because I have moved some constraintSpecs from an
>> element spec (where, I gather, the element being defined supplies the
>> context) into a spec containing a definition of a new attribute class
>> that the element now belongs to.
>> I have searched the Guidelines for some examples, but failed to see any
>> that would use "context=" with Schematron. A modified example that I
>> earlier received from Syd has this:
>> <sch:rule context="*[@referringMode eq 'pointer']"> ...
>> and it works really well, but is that the magic that I need for
>> restricting Schematron to only the elements which are members of the
>> class that I am defining?
>> A naive reading of the above context would suggest that the Schematron
>> rule still applies to all elements except the root element (and then it
>> of course filters them appropriately). So where is the trick, please,
>> what am I missing?
>> Thanks in advance,