Skip to content

Instantly share code, notes, and snippets.

@jamescummings
Last active March 10, 2017 14:32
Show Gist options
  • Save jamescummings/155429676474d9416b8251c717776657 to your computer and use it in GitHub Desktop.
Save jamescummings/155429676474d9416b8251c717776657 to your computer and use it in GitHub Desktop.
Just a quick test using the tei_math ODD to add a new attribute with the same name as a TEI one.
<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:lang="en" xmlns="http://www.tei-c.org/ns/1.0"
xmlns:rng="http://relaxng.org/ns/structure/1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
>
<teiHeader>
<fileDesc>
<titleStmt>
<title>TEI with MathML and testing attributes with same name</title>
<author>Sebastian Rahtz</author>
</titleStmt>
<publicationStmt>
<p>Blah</p>
</publicationStmt>
<sourceDesc>
<p>authored from scratch</p>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<p>Just a quick test using the tei_math ODD to add a new attribute with the same name as a TEI one.</p>
<schemaSpec ident="tei_math" prefix="tei_" start="TEI teiCorpus" xmlns:teix="http://www.tei-c.org/ns/Examples"
defaultExceptions="http://www.w3.org/1998/Math/MathML http://www.tei-c.org/ns/1.0 teix:egXML">
<moduleRef
url="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/mathml2-main.rng"/>
<moduleRef key="header"/>
<moduleRef key="core"/>
<moduleRef key="tei"/>
<moduleRef key="textstructure"/>
<moduleRef key="figures"/>
<elementSpec module="figures" ident="formula" mode="change">
<content>
<rng:ref name="mathml.math"/>
</content>
</elementSpec>
<elementSpec ident="TEI" module="textstructure" mode="change">
<attList>
<!-- A new attribute with a different name -->
<attDef ident="blort" ns="http://www.w3.org/1998/Math/MathML" mode="add">
<valList type="closed">
<valItem ident="foo"><desc>foo</desc></valItem>
</valList>
</attDef>
<!-- A new attribute with the same name -->
<attDef ident="n" ns="http://www.w3.org/1998/Math/MathML" mode="add">
<valList type="closed">
<valItem ident="NValue"><desc>NValue</desc></valItem>
</valList>
</attDef>
</attList>
</elementSpec>
</schemaSpec>
</body>
</text>
</TEI>
@lb42
Copy link

lb42 commented Mar 10, 2017

Your ODD defines a second attribute called n as a local child of the TEI element, rather than as a member of att.global. But the n supplied by att.global is still there: hence the duplication. And neither of them works because of the name clash. Just for completeness, here's my (slightly simpler) demonstration file

<schemaSpec ident="myTEI" start="p">
            <moduleRef key="tei"/>
            <classSpec ident="att.global" mode="change" type="atts">
               <attList>
                  <attDef ident="notN" ns="mynamespace.org" mode="add">
                     <desc>This is my funky variant on an N</desc>
                     <valList type="closed">
                        <valItem ident="poo"/>
                        <valItem ident="bah"/>
                     </valList>
                  </attDef>
                  <attDef ident="n" ns="mynamespace.org" mode="add">
                     <desc>This is my nondoing funky variant on an N</desc>
                     <valList type="closed">
                        <valItem ident="poo"/>
                        <valItem ident="bah"/>
                     </valList>
                  </attDef>
               </attList>
            </classSpec>
            <elementRef key="p"/>
      </schemaSpec>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment