Schematron / schematron-enhancement-proposals

This repository collects proposals to enhance Schematron beyond the ISO specification
7 stars 0 forks source link

Aligining the definitions for title and p elements (or clarifying the difference?) #20

Open xatapult opened 3 years ago

xatapult commented 3 years ago

The (not often used) <title> and <p> Schematron elements have different models for no apparent reason.

I suggest we align both definitions and allow the same kinds of mixed contents in both of them. Best probably to define <title> the same as <p>.

tgraham-antenna commented 3 years ago

<dir> can be mapped to Unicode's directional override characters, so <title> is effectively text with syntactic sugar for directionality overrides (except that the syntactic sugar allows foreign elements).

A HTML <title> can also contain only text.

I'm not advocating either way, but an argument for a simple <title> is that a styled title might lose meaning or be confusing if it ends up somewhere where only text is allowed, such as the banner of a window or the metadata of a PDF report.

xatapult commented 3 years ago

an argument for a simple is that a styled title might lose meaning or be confusing if it ends up somewhere where only text is allowed, such as the banner of a window or the metadata of a PDF report.</p> </blockquote> <p>True. However, other text standards, such as DocBook, simply allow mixed text, with all its markup elements, everywhere where text can be, so also in <code><title></code> elements. I think this consistency is preferable above deciding upfront what content developers should or should not do. </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/rjelliffe"><img src="https://avatars.githubusercontent.com/u/25023785?v=4" />rjelliffe</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Are titles different from paragraphs and divs? Definitely yes!</p> <p>We should consider the Gherkin BDD language, which is used to generate stubs for the popular Cucumber BDD Unit Test runner (for Ruby, JavaScript, Java, etc). It is <em>VERY</em> commonly used and highly regarded. It is entirely based on automatically converting titles into programming language identifiers (e.g. function names). </p> <p>Gherkin's design has evolved to have many of the same language features as Schematron: a separation between expression of scenario in native language and implementation in code (e.g. as sch:assert/@test does), relatively flat simple structure (Feature/Rule/Scenario/Step is akin to schema/pattern/rule/assert), variables, macros, a way to avoid context recomputation (in Schematron this is the sch:rule chain, in Gherkin it is the Background feature), and so on. </p> <p>And guess what?, those top three levels (Feature, Rule, Scenario) all require a title (which they munge into a name token by substituting " " with "_" for example) and allow free-text comments as paragraphs after the title, to explain things. (And which are distinct from stripped #comments that are ephemeral.) Just like Scematron.</p> <p>So we can imagine an application that takes a Schematron schema and transforms it into, say, idomatic JUnit Unit Tests for Java: and uses the (munged) titles as function names for literate code (or ids otherwise). It would be good if this were just a matter of taking the simple value of the sch:title/sch:p.</p> <p>But if the foreign element had text, is is supposed to be displayed as part of the title or not? For example</p> <sch:pattern id="p2022"> <sch:title>Drug Interaction Test Rules as at <external:date date="2022-02-20">202e</external-date> <external:note id="f1">Provenance Note: these rules were approved by Committee X on 2022-01-0-31 and made under Code 7 of the Pharmacy/Illuminat Co-Prosperity Sphere Guidelines.</external:note></sch:title> We have two foreign elements: one does belong to the display text of the title (which would be munged to make the identifier) but the other does not. We don't want to ignore the date (because there may be other patterns with the same naming convention for other years; and we don't want to put in the full external:note because of size and that it may change without requiring a regeneration of the code; so there is no failsafe general policy. If you wanted to allow foreign elements with no text value, that is no problem for this, of course. But if you allow foreign elements, you give up that implementation technique, which is unnecessary. Now I do not know of anyone who has implemented Schematron-to-JUnit (etc) with this name munging. But do we have any actual report that anyone has had a problem with an sch:title not allowing foreign elements? If there is no actual problem reported, and the feature supports a particular *COMMON* implementation technique in the testing/validation sector, then it is better to keep it. ------- As for DOCBOOK, I see an application that converts a Schematron schema to DOCBOOK (or any other rich text), but I don't see that there is any requirement that DOCBOOK be converted into Schematron code (is there?) So I think there is an argument that Schematron rich text should be able to drive DOCBOOK or DITA well, but not that it should losslessly round-trip. </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>