Skip to content

Commit

Permalink
Make u/@who optional and so fix conversion to vert (cf. #29)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomazErjavec committed Feb 3, 2021
1 parent 1cdb94f commit 1e19dbd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Schema/ParlaMint-TEI.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ u =
>> a:documentation [ "Attributes to link split utterances." ],
attribute prev { xsd:anyURI }?,
attribute next { xsd:anyURI }?,
who.att,
who.att?,
ana.att,
attribute source { anyURIs }?,
(seg | comment | pb)+
Expand Down
4 changes: 3 additions & 1 deletion Schema/ParlaMint-TEI.rng
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,9 @@
<data type="anyURI"/>
</attribute>
</optional>
<ref name="who.att"/>
<optional>
<ref name="who.att"/>
</optional>
<ref name="ana.att"/>
<optional>
<attribute name="source">
Expand Down
2 changes: 1 addition & 1 deletion Schema/ParlaMint-TEI.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
<xs:attributeGroup ref="ns1:global.atts"/>
<xs:attribute name="prev" type="xs:anyURI"/>
<xs:attribute name="next" type="xs:anyURI"/>
<xs:attributeGroup ref="ns1:who.att"/>
<xs:attribute name="who" type="xs:anyURI"/>
<xs:attributeGroup ref="ns1:ana.att"/>
<xs:attribute name="source" type="ns1:anyURIs"/>
</xs:complexType>
Expand Down
22 changes: 15 additions & 7 deletions Scripts/parlamint2xmlvert.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,23 @@
<xsl:text>&#10;</xsl:text>
</xsl:template>

<xsl:template match="tei:u[not(@who and @who != '#')]">
<xsl:message>
<xsl:text>ERROR: u </xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text> without @who, skipping!</xsl:text>
</xsl:message>
<xsl:template match="tei:u[not(@who)]">
<xsl:message select="concat('WARN: u ', @xml:id, ' without @who')"/>
<speech id="{@xml:id}">
<xsl:attribute name="speaker_id">?</xsl:attribute>
<xsl:attribute name="speaker_name">?</xsl:attribute>
<xsl:attribute name="speaker_role">?</xsl:attribute>
<xsl:attribute name="speaker_type">?</xsl:attribute>
<xsl:attribute name="speaker_party">?</xsl:attribute>
<xsl:attribute name="speaker_party_name">?</xsl:attribute>
<xsl:attribute name="speaker_gender">?</xsl:attribute>
<xsl:attribute name="speaker_birth">?</xsl:attribute>
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates/>
</speech>
</xsl:template>

<xsl:template match="tei:u">
<xsl:template match="tei:u[@who]">
<speech id="{@xml:id}">
<xsl:variable name="speaker" select="key('idr', @who, $teiHeader)"/>
<xsl:choose>
Expand Down

0 comments on commit 1e19dbd

Please sign in to comment.