As mentioned above, rapid cyclic testing is not
particularly difficult: just take an XML file that has a test
selector on a tei:rendition/@selector
, and
validate it against the generated RELAX NG schema or transform
it with the generated XSLT stylesheet. But I am personally
fond of creating self-testing systems, in part because it
takes literate programming to a next step, keeping the test
cases in with the original documentation and program, thus
keeping all the concerns (as it were) in one file; and in part
just because it’s cool.
Observing that
RELAX NG permits elements from namespaces
other than the RELAX NG namespace to occur in a grammar
(even as a direct child of rng:grammar
), and
XSLT permits elements from namespaces other
than the XSLT namespace to occur in a stylesheet (even as a
direct child of xsl:stylesheet
or
xsl:transform
),
I could insert the desired tests directly into the
CSS3_selector_regex_generator.perl
program such that they would be inserted into the output RELAX
NG schema or XSLT program as the value of a
tei:rendition/@selector
. The regular expression
could then be tested against the test CSS selectors by
validating the output RELAX NG grammar against
itself (that is, use the generated RELAX NG schema
as both the grammar and the document instance), or by
transforming the XSLT stylesheet with
itself (that is, use the generated XSLT program as
both the stylesheet and the input document).