Adding article-meta with JATSParserPlugin to article display

This is primarily a question for @Vitaliy with respect to a feature we are working to add to the JATSParserPlugin.

The journal we will be publishing in JATS specializes in book reviews and we need to add the citation for the book under review to the article display. The data for the book-under-review is embedded in an “article-meta/product” element in our valid JATS XML files.

    <product product-type="book">
        <year iso-8601-date="2019"></year>

We know that the JATSParserPlugin is not written to process and display metadata, but I’m wondering if we could get some guidance on adding it ourselves. I’ve tried to follow the model in a pull request proposed by “marciuz” that adds a Front namespace to the processor stack. But I haven’t been had any success getting the data passed into the HTML portion of the process and included in the template $htmlDocument variable.

We’re working with OJS 3.2.x, PHP 7.3, and JATSParser

With thanks,

Richard Higgins
Indiana University Libraries

Hi @Richard-Higgins,

The referenced PR doesn’t include any code to the HTML part of the parser. In general, I’m ok with the approach used in this PR, the only thing that I’d change is using more abstractions. Instead of iterating through all elements directly, like:

$articleMeta = self::$xpath->query(".//article-meta[1]", $meta);
		if ($articleMeta->length > 0) {

I’d create a method or two methods to extract every piece of data individually, passing XPath query as a parameter. Article’s front part can extend AbstractElement class and use this inherited methods:

Display of this data should be conditional, I don’t mind to include this into JATS Parser library but not in the plagin itself. E.g., add s set method in the …HTML/Document class: This class extends PHP DOMDocumet and represents the HTML Doculent. So, depending on where you want to display it, just append as per DOMDocument/DOMElement documentation: PHP: DOMDocument - Manual. I recommend make it the same as for other elements, e.g., references, create a class, say Front, that extends DOMElement where there actual work is done.

As mentioned before, this should be conditional. i.e. implemented outside of the …HTML\Document constructor, the same as references. Then, after creating a class in the plugin itself here: JATSParserPlugin/ at e861fc56341b28072399fbfca983a4704ccff621 · Vitaliy-1/JATSParserPlugin · GitHub, metadata may be added with a simple settter, like $htmlDocument->setFront(), the same way as references. Later, I’ll add a hook there, to be able to modify HTML outside the plugin.

Let me know if you need some help or want to contribute.

1 Like