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 the process of importing (include,extending, etc.) definitions from an external ISO Schematron schema #66

Open
dmj opened this issue Feb 16, 2024 · 3 comments
Labels
proposed Proposed enhancement

Comments

@dmj
Copy link
Member

dmj commented Feb 16, 2024

In short. The elements sch:include and sch:extends are used to incorporate definitions from an external ISO Schematron schema or schema fragment. Such an external definition may depend on top-level definitions of the external schema.

Consider the following case. A schema A includes a pattern from a different schema B.

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <sch:ns prefix="example" uri="http://example.com/ns"/>
  <sch:include href="schema-b.sch#pattern-b"/>
</sch:schema>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <sch:ns prefix="ex" uri="http://example.com/ns"/>
  <sch:let name="allowedTypes" value="tokenize('foo bar', ' ')"/>
  <sch:pattern id="pattern-b">
    <sch:rule context="ex:element[@type = $allowedTypes]">
      <sch:assert test="false()" diagnostics="diag-1"/>
    </sch:rule>
  </sch:pattern>
  <sch:diagnostics>
    <sch:diagnostic id="diag-1">...</sch:diagnostic>
  </sch:diagnostics>
</sch:schema>

Simply replacing the sch:include element in A with the pattern from B does not produce a working schema.

A definition of importing would discuss how to make top-level definitions from an external schema available.

See also: Maus, David. 2021. “What’s in a Schematron?” In Markup UK 2021 Proceedings. Online. https://markupuk.org/webhelp/index.html#ar02.html, esp. the section on schema composition.

@rjelliffe
Copy link
Member

rjelliffe commented Feb 17, 2024 via email

@AndrewSales AndrewSales added the proposed Proposed enhancement label Feb 17, 2024
@AndrewSales
Copy link
Collaborator

Thanks, @dmj .

I'm inclined to agree with @rjelliffe here.

extends isn't currently allowed at the top level (the skeleton implementation at least allowed it and enables what Rick describes), but is proposed to be added there, see Schematron/schema@58c1549#diff-9202b75b42b32283bb7212d62805a7e9f1f5b40b7c3b322a3ad20d7dd9bf0111R40.

FWIW, I've found this kind of idiom useful, defining a "header" of top-level declarations, which another schema can then extend:

<!--header.sch-->
<schema>
  <!-- some top-level declarations -->
  <ns .../>
  <let .../>
  <!--etc.-->

  <!--empty pattern, for validity-->
  <pattern/>
</schema>
<schema>
  <extends href='header.sch'/>
  <!--top-level decls now available here-->
  <!-- etc.-->
</schema>

It's good to start this discussion now, please do continue to flesh it out (noting also #67) -- but to manage expectations, I think it's unlikely we'll be able to incorporate this into the next edition, given the time available to finalize the working draft. So it might need to wait until the one after next...

@rjelliffe
Copy link
Member

rjelliffe commented Feb 17, 2024 via email

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

No branches or pull requests

3 participants