phax / ph-schematron

Java Schematron library that supports XSLT and native application
Apache License 2.0
111 stars 36 forks source link

Schematron http://docbook.org/xml/5.0/sch/docbook.sch #95

Closed aanno closed 4 years ago

aanno commented 4 years ago

Using the official DocBook Schematron from http://docbook.org/xml/5.0/sch/docbook.sch is not possible:

com.helger.schematron.pure.exchange.SchematronReadException: schema/5.0/docbook-5.0/sch/docbook.sch: The passed element is not an ISO Schematron element!

The Schematron starts with

<?xml version="1.0" encoding="utf-8"?>
<s:schema xmlns:s="http://www.ascc.net/xml/schematron"
          xmlns:db="http://docbook.org/ns/docbook">
   <s:ns prefix="db" uri="http://docbook.org/ns/docbook"/>
   <s:pattern name="Glossary 'firstterm' type constraint">
      <s:rule context="db:firstterm[@linkend]">

But a different NS is expected:

<?xml version="1.0" encoding="utf-8"?>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:db="http://docbook.org/ns/docbook">
   <s:ns prefix="db" uri="http://docbook.org/ns/docbook"/>
   <s:pattern name="Glossary 'firstterm' type constraint">
      <s:rule context="db:firstterm[@linkend]">
aanno commented 4 years ago

Well, I guess it is because the Schematron is 'too old'. Is there any way to circumvent the problem?

aanno commented 4 years ago

https://github.com/aanno/ph-schematron/tree/issue_95 would solve this. But I don't know if it is acceptable for you... (At least, it needs a refactoring.)

phax commented 4 years ago

lol - sure make a PR. I will slightly adopt the naming but I guess it makes sense to increase backwards compatibility.

aanno commented 4 years ago

@phax: Thank you for merging #97!

phax commented 4 years ago

Thanks for pointing that out. I reworked the code a little bit (for API backwards compatibility) and will release 5.4.1 soon.