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

Defining namespaces #62

Open
AndrewSales opened this issue Jun 7, 2023 · 5 comments
Open

Defining namespaces #62

AndrewSales opened this issue Jun 7, 2023 · 5 comments

Comments

@AndrewSales
Copy link
Collaborator

AndrewSales commented Jun 7, 2023

@dmj raised this in his talk about atop at the users meetup last week.

If I understood correctly, the use case is to embed the definition of Schematron constraints in isolation from a complete schema. Without visibility of ns elements, there is no mechanism at hand to define namespaces used by the query language expression.

Possible options here include:

  1. Allow ns to occur wherever needed, e.g. as a child of pattern, etc.
  2. Allow xmlns pseudo-attributes to declare namespaces, in line with the standard mechanism.
  3. Deprecate ns as it is currently defined, but allow its continued usage, for backward compatibility.
  4. Remove ns altogether (in favour of e.g. (2) above), removing backward compatibility.

See also AndrewSales/XQS#15.

@rjelliffe
Copy link
Member

rjelliffe commented Jun 8, 2023 via email

@rjelliffe
Copy link
Member

rjelliffe commented Jun 8, 2023 via email

@AndrewSales
Copy link
Collaborator Author

I don't understand the use-case

At which point we should ask the proponents to explain. @dmj , @sydb - do you have any comment here?

@dmj
Copy link
Member

dmj commented Jul 28, 2023

I think I was mistaken and there is no need to change a thing: Global namespace bindings via sch:ns are just fine, a ISO Schematron processor just has to turn them into xmlns-namespace bindings early on when including external references.

It would be helpful if the specification would explain what a user of ISO Schematron should expect to work and what not. I.e. wether namespaces bound by sch:ns should carry over when a schema fragment is included.

Example:

Schema A

  <schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
    <ns prefix="ex" uri="http://example.com/ns"
    <pattern>
      <rule context="ex:parent">
        <extends href="schema-b.sch#target"/>
        <assert test="count(ex:child) gt 1"/>
      </rule>
    </pattern>
  </schema>

Schema B

  <schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
    <ns prefix="ex" uri="http://example.com/other-ns"/>
    <pattern>
      <rule  xml:id="target" abstract="true">
        <assert test="exists(ex:title)"/>
      </rule>
    </pattern>
  </schema>

I think it would be reasonable to expect the included assertion tests for a title element in the http://example.com/other-ns namespace, not a title element in the http://example.com/other-ns namespace.

@dmj
Copy link
Member

dmj commented Jul 28, 2023

On the other hand: The problem we face with ATOP is that we want to compose a ISO Schematron schema from rules and patterns defined in different documents, from different people in different times. The xmlns pseudo attribute allows us to preserve all the namespace bindings and assemble a complete ISO Schematron schema.

I can't see a way we can achieve this with the sch:ns elements without renaming prefixes, which in turn means parsing the XPath expressions.

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

3 participants