Quote indicates source.odd

From TEIWiki
Revision as of 03:42, 23 April 2012 by Syd (talk | contribs) (oops -- add category)
Jump to navigation Jump to search

See this post and the rest of the thread it initiated for information on what this snippet does and why.

<!-- fragment of ODD (wrapped in a <schemaSpec> just to hold  -->
<!-- namespace declarations) that adds a cit= attribute and a -->
<!-- ref= attribute to <quote> -->
<!-- Copyleft 2008 Syd Bauman and the Brown University Women  -->
<!-- Writers Project                                          -->
<schemaSpec ident="source-references-for-quote-element"
	    xmlns:rng="http://relaxng.org/ns/structure/1.0"
	    xmlns:isosch="http://purl.oclc.org/dsdl/schematron"
	    xmlns:sch="http://www.ascc.net/xml/schematron"
	    xmlns="http://www.tei-c.org/ns/1.0" xml:lang="en">
  <!-- Add cit= and ref= to <quote> -->
  <elementSpec module="core" ident="quote" mode="change">
    <content>
      <rng:ref name="macro.specialPara"/>
    </content>
    <constraintSpec scheme="schematron" ident="quotation_pointers_1.5">
      <constraint>
	<sch:pattern name="cit-should-point-to-bibl">
	  <sch:rule context="quote[starts-with(@cit,'#')]">
	    <sch:assert test="//bibl[@xml:id=substring-after(current()/@cit,'#')]">cit= attribute of
	    <gi><sch:name/></gi> does not point to a <gi>bibl</gi>.</sch:assert>
	  </sch:rule>
	  <sch:rule context="quote[contains(@cit,'#')]">
	    <sch:assert
		test="document(substring-before(@cit,'#'))//bibl[@xml:id=substring-after(current()/@cit,'#')]">cit=
	    attribute of <gi><sch:name/></gi> does not point to
	    a <gi>bibl</gi>.</sch:assert>
	  </sch:rule>
	  <sch:rule context="quote[@cit]">
	    <sch:report test="not(contains(@cit,'#'))">cit= attribute of <gi><sch:name/></gi> must
	    point to particular <gi>bibl</gi> element via its xml:id=</sch:report>
	  </sch:rule>
	</sch:pattern>
	<sch:pattern name="ref-should-point-to-biblX">
	  <sch:rule context="quote[starts-with(@ref,'#')]">
	    <sch:assert test="//*[@xml:id=substring-after(current()/@ref,'#')][starts-with(local-name(.),'bibl')]">ref= attribute of <gi><sch:name/></gi> does not point to a <gi>bibl</gi>,
	    <gi>biblStruct</gi>, or <gi>biblFull</gi>.</sch:assert>
	  </sch:rule>
	  <sch:rule context="quote[contains(@ref,'#')]">
	    <sch:assert test="document(substring-before(@ref,'#'))//*[@xml:id=substring-after(current()/@ref,'#')][starts-with(local-name(.),'bibl')]">ref= attribute of <gi><sch:name/></gi> does not point to a <gi>bibl</gi>,
	    <gi>biblStruct</gi>, or <gi>biblFull</gi>.</sch:assert>
	  </sch:rule>
	  <sch:rule context="quote[@ref]">
	    <sch:report test="not(contains(@ref,'#'))">ref= attribute of <gi><sch:name/></gi> must
	    point to particular <gi>bibl</gi>, <gi>biblStruct</gi>, or
	    <gi>biblFull</gi> element via its xml:id=</sch:report>
	  </sch:rule>
	</sch:pattern>
      </constraint>
    </constraintSpec>	    
    <constraintSpec scheme="isoschematron" ident="quotation_pointers">
      <constraint>
	<isosch:pattern>
	  <isosch:rule context="quote[starts-with(@cit,'#')]">
	    <isosch:assert test="//bibl[@xml:id=substring-after(current()/@cit,'#')]">cit= attribute of
	    <gi><isosch:name/></gi> does not point to a <gi>bibl</gi>.</isosch:assert>
	  </isosch:rule>
	  <isosch:rule context="quote[contains(@cit,'#')]">
	    <isosch:assert
		test="document(substring-before(@cit,'#'))//bibl[@xml:id=substring-after(current()/@cit,'#')]">cit=
	    attribute of <gi><isosch:name/></gi> does not point to
	    a <gi>bibl</gi>.</isosch:assert>
	  </isosch:rule>
	  <isosch:rule context="quote[@cit]">
	    <isosch:report test="not(contains(@cit,'#'))">cit= attribute of <gi><isosch:name/></gi> must
	    point to particular <gi>bibl</gi> element via its xml:id=</isosch:report>
	  </isosch:rule>
	</isosch:pattern>
	<isosch:pattern>
	  <isosch:rule context="quote[starts-with(@ref,'#')]">
	    <isosch:assert test="//*[@xml:id=substring-after(current()/@ref,'#')][starts-with(local-name(.),'bibl')]">ref= attribute of <gi><isosch:name/></gi> does not point to a <gi>bibl</gi>,
	    <gi>biblStruct</gi>, or <gi>biblFull</gi>.</isosch:assert>
	  </isosch:rule>
	  <isosch:rule context="quote[contains(@ref,'#')]">
	    <isosch:assert test="document(substring-before(@ref,'#'))//*[@xml:id=substring-after(current()/@ref,'#')][starts-with(local-name(.),'bibl')]">ref= attribute of <gi><isosch:name/></gi> does not point to a <gi>bibl</gi>,
	    <gi>biblStruct</gi>, or <gi>biblFull</gi>.</isosch:assert>
	  </isosch:rule>
	  <isosch:rule context="quote[@ref]">
	    <isosch:report test="not(contains(@ref,'#'))">ref= attribute of <gi><isosch:name/></gi> must
	    point to particular <gi>bibl</gi>, <gi>biblStruct</gi>, or
	    <gi>biblFull</gi> element via its xml:id=</isosch:report>
	  </isosch:rule>
	</isosch:pattern>
      </constraint>
    </constraintSpec>	    
    <attList>
      <attDef ident="cit" mode="add" usage="opt">
	<gloss>prose citation reference</gloss>
	<desc>points to (one or more) bibliographic citation(s)
	for this quotation as they appear in the source</desc>
	<datatype minOccurs="1" maxOccurs="unbounded">
	  <rng:ref name="data.pointer"/>
	</datatype>
      </attDef>
      <attDef ident="ref" mode="add" usage="opt">
	<gloss>formal citation reference</gloss>
	<desc>points to (one or more) complete modern
	bibliographic citation(s) for this quotation, typically
	stored in a <gi>listBibl</gi> in the project
	bibliography</desc>
	<datatype minOccurs="1" maxOccurs="unbounded">
	  <rng:ref name="data.pointer"/>
	</datatype>
      </attDef>
    </attList>
  </elementSpec>
</schemaSpec>