Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no duplicate <attDef>s allowed #2534

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 81 additions & 28 deletions P5/Source/Specs/attList.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- © TEI Consortium. Dual-licensed under CC-by and BSD2 licenses; see the file COPYING.txt for details. -->
<?xml-model href="https://jenkins.tei-c.org/job/TEIP5-dev/lastSuccessfulBuild/artifact/P5/release/xml/tei/odd/p5.nvdl" type="application/xml" schematypens="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"?>
<elementSpec xmlns="http://www.tei-c.org/ns/1.0" module="tagdocs" ident="attList">
<elementSpec xmlns="http://www.tei-c.org/ns/1.0" module="tagdocs" ident="attList" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
<gloss xml:lang="en" versionDate="2020-12-20">attribute list</gloss>
<gloss versionDate="2007-06-12" xml:lang="fr">liste d'attributs</gloss>
<desc versionDate="2005-01-14" xml:lang="en">contains documentation for all the attributes associated with this element, as a series of
<gi>attDef</gi> elements.</desc>
<desc versionDate="2005-01-14" xml:lang="en">contains documentation for all the attributes associated with this element, as a series of <gi>attDef</gi> elements.</desc>
<desc versionDate="2007-12-20" xml:lang="ko">일련의 <gi>attDef</gi> 요소로서, 이 요소와 연관된 모든 속성에 대한 기록을 포함한다.</desc>
<desc versionDate="2007-05-02" xml:lang="zh-TW">包含所有和此元素相關的屬性記錄,使用一連串的元素<gi>attDef</gi>。</desc>
<desc versionDate="2008-04-05" xml:lang="ja">当該要素に関する全ての属性に関する文書を、一連の要素<gi>attDef</gi> で示す。</desc>
<desc versionDate="2007-06-12" xml:lang="fr">contient la documentation pour tous les attributs
associés à cet élément comme une série d'éléments <gi>attDef</gi>.</desc>
<desc versionDate="2007-05-04" xml:lang="es">contiene documentación relativa a todos los atributos
asociados con este elemento bajo forma de series de elementos attDef.</desc>
<desc versionDate="2007-01-21" xml:lang="it">contiene la documentazione relativa agli attributi
associati all'elemento in questione sotto forma di una serie di elementi attDef</desc>
<desc versionDate="2007-06-12" xml:lang="fr">contient la documentation pour tous les attributs associés à cet élément comme une série d'éléments <gi>attDef</gi>.</desc>
<desc versionDate="2007-05-04" xml:lang="es">contiene documentación relativa a todos los atributos asociados con este elemento bajo forma de series de elementos attDef.</desc>
<desc versionDate="2007-01-21" xml:lang="it">contiene la documentazione relativa agli attributi associati all'elemento in questione sotto forma di una serie di elementi attDef</desc>
<classes>
<memberOf key="att.global"/>
</classes>
<content>

<alternate minOccurs="1" maxOccurs="unbounded">
<elementRef key="attRef"/>
<elementRef key="attDef"/>
<elementRef key="attList"/>
</alternate>

<alternate minOccurs="1" maxOccurs="unbounded">
<elementRef key="attRef"/>
<elementRef key="attDef"/>
<elementRef key="attList"/>
</alternate>
</content>
<constraintSpec scheme="schematron" ident="no_duplicate_attrs">
<desc>Because it is illegal in XML to have two attributes with the
same name on the same element instance, it is illegal in TEI to
have two <gi>attDef</gi> elements with the same values of
<att>ns</att> and <att>ident</att> in a single <gi>attList</gi>,
unless the parent <gi>attList</gi> has an <att>org</att> of
<val>choice</val>. This applies regardless of the <att>mode</att>
of each <gi>attDef</gi>.</desc>
<constraint>
<sch:rule context="tei:attList[ not( ancestor::tei:attList ) ]">
<!--
Set up a dummy string that contains at least 1 character that
is not legal in a URI, and thus cannot be a namespace.
-->
<sch:let name="notanamespace" value="'☮🄯'"/>
<!-- generate a sequence of my <attDef> descendants -->
<sch:let name="defs" value="descendant::tei:attDef"/>
<!--
get a sequence of @ns & @ident combinations of those
<attDef>s, except ignore those whose parent is an
<attList> that is an alternation, and for which we have
already recorded this @ident. Thus if we see
<attList org="choice">
<attDef ident="klaatu"/>
<attDef ident="bodsworth"/>
<attDef ident="rugglesby"/>
<attDef ident="klaatu"/>
</attList>
The sequence should be ('klaatu','bodsworth','rugglesby','').
-->
<sch:let name="nsidents"
value="for $ad in $defs return
if ( $ad[
parent::tei:attList[ @org eq 'choice']
and
preceding-sibling::tei:attDef[
@ident eq $ad/@ident
and
( @ns, $notanamespace )[1] eq ( $ad/@ns, $notanamespace )[1]
]
]
)
then ''
else normalize-space( if ($ad/@ns) then 'Q{'||$ad/@ns||'}'||$ad/@ident else $ad/@ident )
"/>
<!-- get a sequence of any that occur 2+ times: -->
<sch:let name="dups" value="for $a in $nsidents return ( $nsidents[ . eq $a ][2] )"/>
<!-- remove any duplicates from the list of duplicates (-: -->
<sch:let name="distinct_dups" value="distinct-values( $dups )"/>
<!--
if there are any values in list of distinct duplicates (other than null),
warn user about them:
-->
<sch:assert test="count( $distinct_dups[ . ne ''] ) eq 0">
Within the attribute list defined in <sch:value-of select="ancestor::*[@ident][1]/@ident"/>,
the following attributes have been defined multiple times: <sch:value-of select="$distinct_dups"/>.
</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<attList>
<attDef ident="org">
<gloss versionDate="2007-07-04" xml:lang="en">organization</gloss>
Expand All @@ -36,15 +90,11 @@
<gloss versionDate="2007-11-06" xml:lang="it">organizzazione</gloss>
<desc versionDate="2023-02-07" xml:lang="en">specifies whether only one (<val>choice</val>) or all (<val>group</val>) of the attributes in the list are available</desc>
<desc versionDate="2007-12-20" xml:lang="ko">목록의 모든 속성이 이용가능하거나(org="group") 그 중 하나만 이용가능한지를 명시한다.</desc>
<desc versionDate="2007-05-02" xml:lang="zh-TW">標明是否列表中的全部屬性皆可使用 (org="group") 、或是僅可使用其中一個
(org="choice")。</desc>
<desc versionDate="2008-04-05" xml:lang="ja">リスト中の属性が全て使用できるか(org="group")、またはその1つだけ
が使用できるか(org="choice")を示す。</desc>
<desc versionDate="2007-06-12" xml:lang="fr">précise si les attributs dans la liste sont tous
disponibles (org="group") ou seulement l'un d'entre eux (org="choice").</desc>
<desc versionDate="2007-05-02" xml:lang="zh-TW">標明是否列表中的全部屬性皆可使用 (org="group") 、或是僅可使用其中一個 (org="choice")。</desc>
<desc versionDate="2008-04-05" xml:lang="ja">リスト中の属性が全て使用できるか(org="group")、またはその1つだけ が使用できるか(org="choice")を示す。</desc>
<desc versionDate="2007-06-12" xml:lang="fr">précise si les attributs dans la liste sont tous disponibles (org="group") ou seulement l'un d'entre eux (org="choice").</desc>
<desc versionDate="2023-03-20" xml:lang="es">indica si solo uno (<val>choice</val>) o todos (<val>group</val>) los atributos de la lista están disponibles</desc>
<desc versionDate="2023-03-21" xml:lang="it">indica se gli attributi contenuti nella lista sono
tutti disponibili (<val>group</val>) o se ne è disponibile solo uno (<val>choice</val>)</desc>
<desc versionDate="2023-03-21" xml:lang="it">indica se gli attributi contenuti nella lista sono tutti disponibili (<val>group</val>) o se ne è disponibile solo uno (<val>choice</val>)</desc>
<datatype><dataRef key="teidata.enumerated"/></datatype>
<defaultVal>group</defaultVal>
<valList type="closed">
Expand Down Expand Up @@ -109,12 +159,15 @@
<egXML xmlns="http://www.tei-c.org/ns/Examples">
<attList org="choice">
<attDef ident="active">
<desc versionDate="2005-07-24" xml:lang="en">identifies the <soCalled>active</soCalled> participants in a non-mutual relationship, or all the participants in a mutual
one.</desc>
<desc versionDate="2005-07-24" xml:lang="en">identifies the
<soCalled>active</soCalled> participants in a non-mutual
relationship, or all the participants in a mutual one.</desc>
<datatype maxOccurs="unbounded"><dataRef key="teidata.pointer"/></datatype>
</attDef>
<attDef ident="mutual" usage="opt">
<desc versionDate="2005-07-24" xml:lang="en">supplies a list of participants amongst all of whom the relationship holds equally.</desc>
<desc versionDate="2005-07-24" xml:lang="en">supplies a list
of participants amongst all of whom the relationship holds
equally.</desc>
<datatype maxOccurs="unbounded"><dataRef key="teidata.pointer"/></datatype>
</attDef>
</attList>
Expand All @@ -124,4 +177,4 @@
<ptr target="#TDTAG"/>
<ptr target="#TDCLA"/>
</listRef>
</elementSpec>
</elementSpec>
Loading