Skip to content

Instantly share code, notes, and snippets.

@pdaengeli
Created March 9, 2017 13:27
Show Gist options
  • Save pdaengeli/62d04d5df3830d54ab09fe3ca89e615a to your computer and use it in GitHub Desktop.
Save pdaengeli/62d04d5df3830d54ab09fe3ca89e615a to your computer and use it in GitHub Desktop.
Allowing custom attributes in TEI (globally)
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0"
xml:lang="en">
<teiHeader>
<fileDesc>
<titleStmt>
<title>TEI with custom attributes</title>
</titleStmt>
<publicationStmt>
<publisher></publisher>
<availability status="free">
<p>This is an example how to introduce a globally usable attribute in its own custom namespace.</p>
</availability>
</publicationStmt>
<notesStmt>
<note type="ns">http://youName.it</note>
</notesStmt>
<sourceDesc>
<p>Written from scratch.</p>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<head>Based on TEI Complete</head>
<p>Just an example</p>
<schemaSpec ident="tei_xy" start="TEI teiCorpus" prefix="tei_">
<moduleRef key="tei"/>
<!-- required -->
<moduleRef key="core"/>
<!-- required -->
<moduleRef key="analysis"/>
<moduleRef key="certainty"/>
<moduleRef key="corpus"/>
<moduleRef key="dictionaries"/>
<moduleRef key="drama"/>
<moduleRef key="figures"/>
<moduleRef key="gaiji"/>
<moduleRef key="header"/>
<!-- required -->
<moduleRef key="iso-fs"/>
<moduleRef key="linking"/>
<moduleRef key="msdescription"/>
<moduleRef key="namesdates"/>
<moduleRef key="nets"/>
<moduleRef key="spoken"/>
<moduleRef key="textcrit"/>
<moduleRef key="textstructure"/>
<!-- required -->
<moduleRef key="transcr"/>
<moduleRef key="verse"/>
<moduleRef key="tagdocs"/>
<classSpec ident="att.global" type="atts" mode="change" module="tei">
<attList>
<attDef ident="myAttribute" ns="http://youName.it">
<desc>@myAttribute may be used in the XML file governed by the resulting schema with an NS prefix that is declared
using 'http://youName.it'; e.g. as `xy:myAttibute` and `xmlns:xy="http://youName.it"`.
As it seems, the local-name of the attribute (as defined in @ident) cannot be identical to an existing local-name
under the TEI namespace.</desc>
<datatype>
<rng:text/>
</datatype>
</attDef>
</attList>
</classSpec>
</schemaSpec>
</body>
</text>
</TEI>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment