Giter Club home page Giter Club logo

tei-strip-and-include's Introduction

TEI Strip and Include Examples

TEI uses <egXML> in a separate namespace (http://www.tei-c.org/ns/Examples) for encoding XML fragments demonstrating the use of some XML, in which the egXML element functions as the root element.

I was driven on the brink of insanity by the fact that the content of <egXML> cannot include any other namespace including http://www.tei-c.org/ns/1.0. Because of this restriction, it is impossible to xi:include fragments from a separate TEI file.

Not being able to validate or reuse one's examples is a total pain in the neck, especially in longer documents.

You can use my quick and dirty workaround, as illustrated by this repo:

  • open the oXygen project file TEI-strinp-and-include-examples.xpr

  • use examples.xml to store and validate all your TEI examples

  • associate this file with an XSLT transformation scenario (in the attached oXygen project TEI-ns-stripper) which uses the provided tei-stripper.xsl

  • every time you add and validate some new TEI content in examples.xml, run the TEI-ns-stripper scenario. It will create a file called examples-stripped.xml, which will be exactly the same as your original example.xml, but it will artificially put the TEI root element in the http://www.tei-c.org/ns/Examples namespace, making it legit for inclusion in <egXML>

  • to include TEI fragments in a TEI document (in this repo, call4examples.xml), use xi:include to include from examples-stripped.xml as opposed to examples.xml, like this:

    <egXML xmlns="http://www.tei-c.org/ns/Examples">
      <xi:include href="examples-stripped.xml" xpointer="element(test/1)"/>
    </egXML>
  • The included fragments will now be in the same namespace as <egXML> which means that your call4examples.xml file will not cause any validation errors, but your included (and potentially reusable) fragments will be the same as those that you validated im examples.xml.

Of course, if there is an easier way to do all this, I'd be thrilled to learn about it.

This is something that should have been considered when deciding on <egXML>. Creating fake TEI files in the wrong namespace is not what I consider best practice.

screenshot

tei-strip-and-include's People

Contributors

ttasovac avatar

Watchers

James Cloos avatar  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.