Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider to add documentation hints inside RNC #3

Open
tomschr opened this issue Aug 16, 2021 · 12 comments
Open

Consider to add documentation hints inside RNC #3

tomschr opened this issue Aug 16, 2021 · 12 comments

Comments

@tomschr
Copy link

tomschr commented Aug 16, 2021

Problem

The current RNC schema of Schematron does not contain any documentation related strings. It is not clear from looking at the schema what these elements and attributes really mean. You have to read the specification.

Suggested solution

It is quite easy to document elements and attribute. For example, this is an original snippet:

attribute id { xsd:ID }?,

to add documentation, use this:

## Identifies the unique ID value of the element
attribute id { xsd:ID }?,

To make this fly, I'd recommend:

  • Make the documentation string short and sweet. There is no need to add lengthy paragraphs.
  • Provide links to the Schematron specification for further details.
  • Create patterns when attributes are needed for more elements. That simplifies and improves reuse. There is no need to repeat yourself.

Benefits

IMHO, adding documentation inside the Schematron schema has these benefits:

  • Gives guiding aids. Some XML editors can show this as a popup when trying to add a new element or attribute.
  • Help beginners to get accustomed to Schematron schema. This works quite good in combination with the first item.
  • Reduces time spent to find out about the meaning of an element/attribute. Sometimes it's enough to let your XML editor show the help without looking for the specification.
  • Allows to link it to the Schematron specification, if wanted.
@rjelliffe
Copy link
Member

rjelliffe commented Aug 16, 2021 via email

@AndrewSales
Copy link
Contributor

AndrewSales commented Aug 16, 2021

It seems to me (though I can't tell for sure) that the schemas were intended to be read as part of the text of the standard, and this may be why they lack internal documentation.

I think the right place for the documentation is actually the schemas, as @tomschr suggests, particularly since they are available under a separate licence.

I see two issues with documenting them externally elsewhere by other means:

  1. It creates a further unofficial source: this repository is itself unofficial, but is at least contributing directly to open-source assets which form part of the standard.
  2. There is nothing wrong per se with using Schematron to document itself - https://github.com/Schematron/schema/blob/main/schematron.sch is just that - but it doesn't address the issue @tomschr raises in the sense that you would still have to read the standard to interpret the documentation. It's a neat idea, but it creates in effect a circular definition.

@tgraham-antenna
Copy link
Member

tgraham-antenna commented Aug 16, 2021

The ## comments are the RNC shorthand for RELAX-NG documentation elements. See clause C.5.3 of ISO/IEC 19757-2:2008. As @tomschr points out, some editors (notably Oxygen) already use this standard mechanism to pop-up tooltips containing the nearest ## comment (and I use this with schemas in multiple Oxygen frameworks).

Schematron should eat its own dog food, yes, but it should also use existing standard (and implemented) mechanisms where they exist. On a more mundane level, the ## comments are presented as tooltips when something is being inserted or when the mouse is over an element or attribute. Unless and until you can get editors to recognise role="INFO documentation" as something special, the Schematron mechanism will result in an explosion of error messages, blue squiggly lines, and blue margin markers, or similar:

https://www.oxygenxml.com/doc/versions/23.1/ug-editor/topics/validate-xml-with-sch.html

@tgraham-antenna
Copy link
Member

It turns out that Oxygen shows tooltips from annotations embedded in its iso-schematron.xsd file:

      XSD schema for ISO Schematron. 
      Converted with TRANG and made some manual fixes to be valid.
      Added annotations.
      George Bina / http://www.oxygenxml.com
      April 11, 2007
      @ 2002-2021 Syncro Soft SRL.
      All rights reserved.
      
      Redistribution and use in source and binary forms, 
      with or without modification, are permitted provided 
      that the following conditions are met:

@rjelliffe
Copy link
Member

rjelliffe commented Aug 17, 2021 via email

@tgraham-antenna
Copy link
Member

Tony wrote:

Unless and until you can get editors to recognise role="INFO
documentation" as something special, the Schematron mechanism will result
in an explosion of error messages, blue squiggly lines, and blue margin
markers, or similar

Sure, and I certainly appreciate that Schematron is sometimes used in
progressive validation, after the grammar.

Even if the Schematron is the only schema and the document is revalidated as you type, current behaviour for Schematron messages is going to present every INFO message anywhere in the document.

But why take a passive approach? Tom is making a specific request, sure;
but it is also something that shows up a limitation/opportunity in
Schematron, and it can be treated as useful feedback on gaps and
requirements.

@tomschr can work out which approach works best in their case, but why reinvent the wheel? Why see everything through the prism of Schematron? Why invent Fuzzy Schematron in response to a question about doc comments in Relax-NG? Instead of putting comments in an existing file and using an existing convention that shows them to the user, you want to split the comments into a (probably) completely different file and rely on machinery that doesn't yet exist?

The issue of what gets the job done for him today is useful; but the issue
of what underlies his request is more important for a standard, isn't it?

IMO, what's important for a standard is that it codify useful and interoperable things.

There's many and varied ways for something to get to the point of being shown to be useful and interoperable, of course, but I would resist calling something a standard if neither of those were true. I've been in a slow-moving exchange on xml-dev about the usefulness or otherwise of SGML's LPDs. There was a brief moment when I was reading about them before I used them when I thought they were useful and interoperable, but neither turned out to be true IMO. Being in the standard didn't make it so.

There is no need for providing one to exlude the other: augmenting the
RELAX NG but leaving the gap in Schematron is a wasted opportunity.

Except that you previously side-stepped anything to do with the RNC.

@tgraham-antenna
Copy link
Member

New Pattern:
...
This is the kind of thing that I would like to see on the planned "open
standard" Schematron site, actually. (Then it is available,
and SC34 can decide whether to also adopt it or not.) To read about that,
see
*https://schematron.com/2021/08/plan-for-alternative-open-standard-text-for-schematron/

That proposes "an alternative description of exactly the same technology as ISO Schematron describes". It's not obvious how 'new pattern' and 'exactly the same technology' are meant to fit together.

@rjelliffe
Copy link
Member

rjelliffe commented Aug 23, 2021 via email

@rjelliffe
Copy link
Member

rjelliffe commented Aug 23, 2021 via email

@tgraham-antenna
Copy link
Member

Lets consider a QLB for XSLT 4.

People could propose the facilities, it could go onto the "Open
Documentation" (that is what I am calling it, not "Open Standard")
site, but with a note saying this is not part of the ISO standard
(and is not final, and might be proposed for an update to the
standard, but even if it were adopted into the ISO standard would
presumably not be normative text anyway.)

There is an existing place for proposals:

https://github.com/Schematron/schematron-enhancement-proposals/issues

It already has 18 proposals, including some from you.

It's pinned to the top of the page for the Schematron organisation here on GitHub: https://github.com/Schematron

The existence of the enhancement proposals is highlighted every month in the 'Schematron List Guidelines' post on the Schematron mailing list.

@tgraham-antenna
Copy link
Member

Even if the Schematron is the only schema and the document is
revalidated as you type, current behaviour for Schematron messages
is going to present every INFO message anywhere in the document.

Why? You configure the application to know which phase (or patterns,
or roles) should be dealt with by a processor that picks what to
validate. If it is put into a phase, in particular, validation of

As before, I am referring to current behaviour.

that schema by an existing validator would not have any effect. And
if you use the <assert test="true()"...> form, the assertion would
never fail as part of validation.

Why see everything through the prism of Schematron? Why invent
Fuzzy Schematron

Aren't I allowed to? ;-)

Everyone is allowed to: https://github.com/Schematron/schematron-enhancement-proposals/issues

I was questioning the connection between Fuzzy Schematron and a request for doc comments. Sometimes a request for doc comments is just a cigar, or something like that.

But three other things come to mind:

  • first, that a standard that does not evolve risks dying;

Who said that Schematron is not evolving? As before: https://github.com/Schematron/schematron-enhancement-proposals/issues

  • second, that innovation only happens when people know innovation is
    welcome and useful

The monthly guidelines for the Schematron community's mailing list includes:

SCHEMATRON ENHANCEMENT PROPOSALS

Please do take a look at the recently updated Schematron
Enhancement Proposals (SEPs):
https://github.com/Schematron/schematron-enhancement-proposals
and the issues raised there. Your active participation and
feedback about these is very welcome, either via this mailing
list or on GitHub, wherever you feel more comfortable
contributing. As ever, it helps a great deal to hear from users
what they find useful.
  • third, no standards-making group, when presented with an issue and a
    solution, does not look beyond the concrete to the conceptual, to see if
    there is some broader issue.

Hence the W3C XSL WG (or just its FO subgroup) didn't look beyond its charter requirement to use CSS properties with their current meaning (https://www.w3.org/Style/2000/xsl-charter.html), didn't treat the CSS2 'vertical-align' property (https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align) as a shorthand for multiple separate properties (https://www.w3.org/TR/xsl11/#vertical-align), didn't separate out the special case for table cells as the 'relative-align' property (https://www.w3.org/TR/xsl11/#relative-align) and didn't think to make 'relative-align' also apply to list items.


BTW, this discussion is reaching an audience of four other people. Comments beyond comments on doc comments would probably be better served by being on the community mailing list.

@rjelliffe
Copy link
Member

rjelliffe commented Aug 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants