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

Define parameters for abstract patterns #8

Closed
xatapult opened this issue Jun 10, 2021 · 7 comments
Closed

Define parameters for abstract patterns #8

xatapult opened this issue Jun 10, 2021 · 7 comments
Labels
2025 A change made in preparing the 2025 edition abstract constructs Issues relating to abstract (patterns, rules) enhancement Adds new capabilities

Comments

@xatapult
Copy link
Collaborator

xatapult commented Jun 10, 2021

There is no way you can define which parameters are there for an abstract pattern. Therefore the processor cannot check that an abstract pattern invocation is correct.

I know that these parameters are macro/text-substituted and are not "real" parameters in the XSLT sense, but nonetheless it would be nice if we could define them, both for checking and code documentation purposes.

@dmj dmj added the enhancement Adds new capabilities label Aug 30, 2021
@xatapult
Copy link
Collaborator Author

xatapult commented Mar 24, 2022

There's another reason we might want to do something about this: XSLT uses <xsl:param> elements to define a parameter in the location where they're used and an <xsl:with-param> to give it a value. But Schematron uses <param> elements to give parameters a value. Since XSLT and Schematron are often used side-by-side, that's confusing...

I know this would seriously break compatibility with previous versions.

@rjelliffe
Copy link
Member

rjelliffe commented Oct 11, 2022 via email

dmj added a commit to schxslt/schxslt2 that referenced this issue Feb 22, 2024
See
Schematron/schematron-enhancement-proposals#8

See

Siegel, Erik. 2022. Schematron: A Language for Validating XML. XML
Press. p. 93
@dmj
Copy link
Member

dmj commented Feb 22, 2024

I'll most likely implement this using processing instructions in SchXslt2. It seems useful to error on both sides: Parameters that are declared but not provided, and parameters that are provided but not declared.

@AndrewSales AndrewSales added the abstract constructs Issues relating to abstract (patterns, rules) label Feb 24, 2024
@AndrewSales
Copy link
Collaborator

I think adding optional-repeatable element param to abstract patterns is a simple enough solution here. I don't think the syntax is that much of an issue - it's unambiguous from the context to a machine and human beings are adept at using the same word in different contexts to express different meanings - plus XSLT is an important query language binding, but only one of them.

However, param as currently defined has mandatory name and value attributes. You may not wish to specify a value for an abstract parameter, and if you do (as you must now), is that value the default? What happens if the concrete pattern also specifies a value for that parameter (it must, as things stand)?

In which case, it seems there are three options:

  1. add param as currently defined: this would compel you to include a value for abstract parameters in a valid schema
  2. make value optional and allow it to be absent for an abstract pattern parameter but required for a concrete one
  3. redefine param when used in an abstract pattern as having only the name attribute.

(2) offers most flexibility, enabling default values.

@rjelliffe
Copy link
Member

rjelliffe commented Mar 12, 2024 via email

@dmj
Copy link
Member

dmj commented Mar 15, 2024

When I implemented the processing instruction I decided against the possibility of default values for backwards compatibility. If this is no convern, then I opt for (2).

@AndrewSales
Copy link
Collaborator

AndrewSales commented Mar 16, 2024

FWIW it's mine too, @dmj .

On the subject of compatibility:

  • an existing implementation would presumably not know what to do with the proposed abstract param
  • it equally would not know how to handle the absence of a param value
  • existing schemas should function just as before, though they would be invalid if the constraint on every concrete parameter requiring an abstract equivalent were added to the Schematron schema schema [Annex B]
  • such invalidity as there is should disappear once the "expansion" processing step is complete, and all abstract patterns have been instantiated. At that stage, schemas using this proposed new mechanism should be backward-compatible on this score.

Correct me if I'm wrong!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2025 A change made in preparing the 2025 edition abstract constructs Issues relating to abstract (patterns, rules) enhancement Adds new capabilities
Projects
None yet
Development

No branches or pull requests

4 participants