Skip to content
This repository was archived by the owner on Mar 10, 2021. It is now read-only.

Conversation

@thewilkybarkid
Copy link
Contributor

@thewilkybarkid thewilkybarkid commented Feb 25, 2019

This adds support for <article> and @xml:lang, and denies everything else.

It includes tests for every JATS element.

<?xml-model href="../jats.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="../../support.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?expected-error line="7" message="<aff-alternatives> is ignored." node="/aff-alternatives"?>
<?expected-error line="8" message="<aff> is ignored." node="//aff"?>
Copy link
Contributor Author

@thewilkybarkid thewilkybarkid Feb 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I'd like to not flag children of sub-elements, but need to be careful with mixed content (they're not necessarily ignored in that case).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could separate block and inline elements, and only check children of the latter.

<?xml-model href="../jats.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="../../support.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?expected-error message="@count-type is ignored."?>
<?expected-error message="@count is ignored."?>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to be able to not flag attributes on ignored elements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a try, but can't get it to work.

<assert test="
name()='article'
">
&lt;<name/>&gt; is ignored.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would be an example of an element that is not ignored (not implemented and hence won't be picked up by anything in browser) but should actually be forbidden? e.g. a variant for article-title that we want to avoid in order to favor other alternatives

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we ever forbid any JATS (this isn't validation); if you want to do something that we don't support then you can use configuration or code to add support for it, or you change your XML to match what is supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a few things we mandate though, like there must be a <title-group> in the <article-meta>.

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../jats.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="../../../support.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?expected-error message="@article-type is ignored."?>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the attribute is a node, we should be able to include a node/line. But the location returned in the SVRL doesn't include proper XPath (so no details of which element the attribute is on):

<svrl:schematron-output xmlns:svrl="http://purl.oclc.org/dsdl/svrl" title="" schemaVersion="">
    
    <svrl:active-pattern id="attribute-whitelist" name="attribute-whitelist"/>

    <svrl:fired-rule context="@*"/>
    <svrl:failed-assert test="name()='xml:lang'" location="/@article-type">
        <svrl:text>
            @article-type is ignored.
        </svrl:text>
    </svrl:failed-assert>

    <svrl:active-pattern id="element-whitelist" name="element-whitelist"/>

    <svrl:fired-rule context="*"/>
    <svrl:fired-rule context="*"/>
    <svrl:failed-assert test="name()='article'" location="/article/front">
        <svrl:text>
            &lt;front&gt; is ignored.
        </svrl:text>
    </svrl:failed-assert>

    <svrl:fired-rule context="*"/>
    <svrl:failed-assert test="name()='article'" location="/article/front/article-meta">
        <svrl:text>
            &lt;article-meta&gt; is ignored.
        </svrl:text>
    </svrl:failed-assert>

</svrl:schematron-output>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thewilkybarkid thewilkybarkid merged commit 7b680e2 into libero:master Mar 6, 2019
@thewilkybarkid thewilkybarkid deleted the start branch March 6, 2019 15:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants