Skip to content

Commit

Permalink
#62
Browse files Browse the repository at this point in the history
First sample of assert usage for restricting Page values
  • Loading branch information
cipriandinu committed Jan 16, 2024
1 parent bde3771 commit 33e1e58
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions v5/alto-5-0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ For the full text see https://creativecommons.org/licenses/by-sa/4.0/legalcode.
5. Adapt xLink attribute group documentation on "BlockType"
-->
<!-- June 2024, version 5.0
4. Restrict values for HPOS VPOS WIDTH HEIGHT relatively to Page coordinates (requires XSD 1.1)
-->
<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">
<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">
<xsd:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.loc.gov/standards/xlink/xlink.xsd"/>
<xsd:element name="alto" type="altoType">
<xsd:annotation>
Expand Down Expand Up @@ -414,7 +415,7 @@ For the full text see https://creativecommons.org/licenses/by-sa/4.0/legalcode.
<xsd:attribute name="PROCESSINGREFS" type="xsd:IDREFS" use="optional"/>
<xsd:attribute name="HEIGHT" type="xsd:float" use="optional"/>
<xsd:attribute name="WIDTH" type="xsd:float" use="optional"/>
<xsd:attribute name="PHYSICAL_IMG_NR" type="xsd:float" use="required">
<xsd:attribute name="PHYSICAL_IMG_NR" type="xsd:integer" use="required">
<xsd:annotation>
<xsd:documentation>The number of the page within the document.</xsd:documentation>
</xsd:annotation>
Expand Down Expand Up @@ -453,6 +454,11 @@ For the full text see https://creativecommons.org/licenses/by-sa/4.0/legalcode.
<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>
</xsd:annotation>
</xsd:attribute>
<xsd:assert test="@PHYSICAL_IMG_NR &gt; 0"/>
<xsd:assert test="not(exists(@HEIGHT)) or @HEIGHT &gt;= 0"/>
<xsd:assert test="not(exists(@WIDTH)) or @WIDTH &gt;= 0"/>
<xsd:assert test="not(exists(@ACCURACY)) or (@ACCURACY &gt;= 0 and @ACCURACY &lt;= 100)"/>
<xsd:assert test="not(exists(@ROTATION)) or (@ROTATION &gt;= -180 and @ROTATION &lt;= 360)"/>
</xsd:complexType>
<xsd:simpleType name="ListOfLanguages">
<xsd:list itemType="xsd:language"/>
Expand Down

0 comments on commit 33e1e58

Please sign in to comment.