GithubHelp home page GithubHelp logo

elife-ingest-xsl's Introduction

The xsl templates for the citation formats have been adapted from examples provided in jats-conversion

git clone [email protected]:elifesciences/elife-ingest-xsl.git
cd elife-ingest-xsl

Install dependencies:

composer install

Generate example template output formats:

./scripts/generate_xslt_output.sh

Usage guidance for this script is:

Usage: generate_xslt_output.sh [-h] [-s <source folder>] [-d <destination folder>]

The default source folder is tests/fixtures/jats. The default destination folder is tests/tmp.

Review the output of example citation formats in the destination folder.

Run PHPUnit tests on example citation formats:

./bin/phpunit

You can filter by a specific method in /tests/simpleTest.php, for example:

./bin/phpunit --filter=testJatsToHtmlDecisionLetter

Apply xsl templates to another JATS XML file:

cat [JATS XML file] | ./scripts/convert_jats.php -t 'bib'
cat [JATS XML file] | ./scripts/convert_jats.php -t 'ris'
cat [JATS XML file] | ./scripts/convert_jats.php -t 'html'

It is possible to use ./scripts/convert_jats.php -t html to target specific portions of the markup.

Here are a few examples:

Retrieve the abstract section:

cat [JATS XML file] | ./scripts/convert_jats.php -t 'html' -m 'getAbstract'

other methods that can be called are: getDigest, getAuthorResponse etc.

Retrieve a fragment doi section:

cat [JATS XML file] | ./scripts/convert_jats.php -t 'html' -m 'getDoi' -a '10.7554/eLife.00288.026'

Retrieve markup by xpath query against the source:

cat [JATS XML file] | ./scripts/convert_jats.php -t 'html' -m 'getSection' -a '[xpath-query]'

Retrieve markup by xpath query against the html:

cat [JATS XML file] | ./scripts/convert_jats.php -t 'html' -m 'getHtmlXpath' -a '[method]|[argument]|[xpath-query]'

for example to retrieve the first p element of the fragment doi 10.7554/eLife.00288.042 for article 00288:

cat tests/fixtures/jats/00288-v1-vor.xml | ./scripts/convert_jats.php -t 'html' -m 'getHtmlXpath' -a 'getDoi|10.7554/eLife.00288.042|//p[1]'

or to get the the div with class="elife-article-author-response-doi" in the author response:

cat tests/fixtures/jats/00288-v1-vor.xml | ./scripts/convert_jats.php -t 'html' -m 'getHtmlXpath' -a 'getAuthorResponse||//div[@class="elife-article-author-response-doi"]'

To process all of the elife articles then do the following:

git clone [email protected]:elifesciences/elife-articles.git
./scripts/generate_xslt_output.sh -s elife-articles -d elife-articles-processed

To get a quick idea of what the main article page will look like you can run the following script:

cat [JATS XML file] | ./scripts/draft_template.php > ~/draft_article.html

then open the html file in your browser. for example:

cat tests/fixtures/jats/00288-v1-vor.xml | ./scripts/draft_template.php > ~/00288.html
open ~/00288.html

Useful resources:

elife-ingest-xsl's People

Contributors

davidcmoulton avatar ddhingra avatar giorgiosironi avatar nlisgo avatar ravi-exeter avatar thewilkybarkid avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.