Skip to content

Commit 33e1e58

Browse files
committed
First sample of assert usage for restricting Page values
1 parent bde3771 commit 33e1e58

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

v5/alto-5-0.xsd

+8-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ For the full text see https://creativecommons.org/licenses/by-sa/4.0/legalcode.
117117
5. Adapt xLink attribute group documentation on "BlockType"
118118
-->
119119
<!-- June 2024, version 5.0
120+
4. Restrict values for HPOS VPOS WIDTH HEIGHT relatively to Page coordinates (requires XSD 1.1)
120121
-->
121-
<xsd:schema xmlns="http://www.loc.gov/standards/alto/ns-v5#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://www.loc.gov/standards/alto/ns-v5#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="5.0">
122+
<xsd:schema xmlns="http://www.loc.gov/standards/alto/ns-v5#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://www.loc.gov/standards/alto/ns-v5#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="5.0">
122123
<xsd:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.loc.gov/standards/xlink/xlink.xsd"/>
123124
<xsd:element name="alto" type="altoType">
124125
<xsd:annotation>
@@ -414,7 +415,7 @@ For the full text see https://creativecommons.org/licenses/by-sa/4.0/legalcode.
414415
<xsd:attribute name="PROCESSINGREFS" type="xsd:IDREFS" use="optional"/>
415416
<xsd:attribute name="HEIGHT" type="xsd:float" use="optional"/>
416417
<xsd:attribute name="WIDTH" type="xsd:float" use="optional"/>
417-
<xsd:attribute name="PHYSICAL_IMG_NR" type="xsd:float" use="required">
418+
<xsd:attribute name="PHYSICAL_IMG_NR" type="xsd:integer" use="required">
418419
<xsd:annotation>
419420
<xsd:documentation>The number of the page within the document.</xsd:documentation>
420421
</xsd:annotation>
@@ -453,6 +454,11 @@ For the full text see https://creativecommons.org/licenses/by-sa/4.0/legalcode.
453454
<xsd:documentation>Other languages that appear on this page. Provides a convenient way to summarize all the languages found on a particular page, without parsing the entire file</xsd:documentation>
454455
</xsd:annotation>
455456
</xsd:attribute>
457+
<xsd:assert test="@PHYSICAL_IMG_NR &gt; 0"/>
458+
<xsd:assert test="not(exists(@HEIGHT)) or @HEIGHT &gt;= 0"/>
459+
<xsd:assert test="not(exists(@WIDTH)) or @WIDTH &gt;= 0"/>
460+
<xsd:assert test="not(exists(@ACCURACY)) or (@ACCURACY &gt;= 0 and @ACCURACY &lt;= 100)"/>
461+
<xsd:assert test="not(exists(@ROTATION)) or (@ROTATION &gt;= -180 and @ROTATION &lt;= 360)"/>
456462
</xsd:complexType>
457463
<xsd:simpleType name="ListOfLanguages">
458464
<xsd:list itemType="xsd:language"/>

0 commit comments

Comments
 (0)