Re: constraining a constraint placed inside a classSpec

Piotr BaƄski <[email protected]> Sat, 25 Mar 2017 15:26:08 +0100
Newsgroups gmane.text.tei.general
Message-ID <[email protected]>
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"
		xmlns:sch="http://purl.oclc.org/dsdl/schematron">
   <constraint>
     <sch:rule context="*[@n]">
       <sch:report test="@n eq 'bunny'">whenever this rule is
             triggered, a cute little bunny dies...</sch:report>
     </sch:rule>
   </constraint>
</constraintSpec>

... 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?

Thanks!

   Piotr

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:
>
> <constraint>
>   <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,
>
>    Piotr
>