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

Rule not fired when context is a comment node #83

Open
dmj opened this issue Aug 6, 2019 · 2 comments
Open

Rule not fired when context is a comment node #83

dmj opened this issue Aug 6, 2019 · 2 comments

Comments

@dmj
Copy link

dmj commented Aug 6, 2019

Using the following Schematron:

<sch:schema>
  <sch:pattern>
    <sch:rule context="comment()">
      <sch:assert test="false()"/>
    </sch:rule>
  </sch:pattern>
</sch:schema>

And the following document:

<?pi Processing instruction ?>
<element attribute="value">
  <!-- Comment -->
  <element>Text content</element>
</element>

I expect the assertion to fail.

But instead I get the following:

<?xml version="1.0" encoding="UTF-8"?>
<schematron-output xmlns="http://purl.oclc.org/dsdl/svrl">
  <active-pattern/>
</schematron-output>

This was discovered with running ph-schematron 5.2.0 against a in-progress schematron testsuite. The complete test results are shown here.

@phax phax self-assigned this Aug 6, 2019
@phax phax added the bug label Aug 6, 2019
@stale
Copy link

stale bot commented Nov 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 4, 2019
@phax phax added pinned and removed wontfix labels Nov 4, 2019
@phax
Copy link
Owner

phax commented Dec 29, 2021

This is a long standing issue, and I tested it with the latest version and here are my results.
When using your proposed Schematron

<?xml version="1.0" encoding="utf-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <sch:pattern>
    <sch:rule context="comment()">
      <sch:assert test="false()">Found a comment</sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>

and this test XML

<?xml version="1.0" encoding="UTF-8"?>
<?pi Processing instruction ?>
<element attribute="value">
  <!-- Comment -->
  <element>Text content</element>
</element>

I get the following output when using the ISO Schematrons:

<?xml version="1.0" encoding="UTF-8"?>
<ns2:schematron-output xmlns:ns2="http://purl.oclc.org/dsdl/svrl" title="" schemaVersion="">
  <ns2:active-pattern document="C:\dev\git\ph-schematron\ph-schematron-xslt\src\test\resources\issues\github83\test.xml" />
</ns2:schematron-output>

The same error with SchXslt 1.8.5:

<?xml version="1.0" encoding="UTF-8"?>
<ns2:schematron-output xmlns:ns2="http://purl.oclc.org/dsdl/svrl">
  <ns2:active-pattern documents="C:\dev\git\ph-schematron\ph-schematron-schxslt\src\test\resources\issues\github83\test.xml" />
</ns2:schematron-output>

and with the pure version:

<?xml version="1.0" encoding="UTF-8"?>
<ns2:schematron-output xmlns:ns2="http://purl.oclc.org/dsdl/svrl">
  <ns2:active-pattern />
</ns2:schematron-output>

In the meantime you maybe more qualified that question yourself @dmj ???

phax added a commit that referenced this issue Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants