Skip to content

Commit

Permalink
Update the XHTML 1.1 RNG schema to latest version
Browse files Browse the repository at this point in the history
* update XHTML 1.1 RNG schema for usemap attribute // refs #696

> Changing the datatype for the usemap attribute from IDREF to URIREF - most user agents require that map references be relative URIs that are local to the document.
 -- see https://www.w3.org/TR/xhtml-modularization/Overview.html#status

* No changes for empty class attributes, added a test anyways // refs #733

Fixes #733
  • Loading branch information
tofi86 authored and rdeltour committed Jun 13, 2017
1 parent 74d0bdd commit 4c6fb49
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<define name="usemap.attlist">
<optional>
<attribute name="usemap">
<ref name="IDREF.datatype"/>
<ref name="URIREF.datatype"/>
</attribute>
</optional>
</define>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
<define name="URI.datatype">
<data type="anyURI"/>
</define>

<define name="URIREF.datatype">
<text/>
</define>

<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
<define name="URIs.datatype">
Expand Down
15 changes: 7 additions & 8 deletions src/test/java/com/adobe/epubcheck/ops/OPSCheckerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -906,14 +906,6 @@ public void testValidateXHTMLImageMap_EPUB2_Valid()
EPUBVersion.VERSION_2);
}

@Test
public void testValidateXHTMLImageMap_EPUB2_Invalid()
{
Collections.addAll(expectedErrors, MessageId.RSC_005);
testValidateDocument("xhtml/invalid/imagemap-bad_issue696.xhtml", "application/xhtml+xml",
EPUBVersion.VERSION_2);
}

@Test
public void testValidateXHTMLImageMap_EPUB3_Valid()
{
Expand All @@ -929,4 +921,11 @@ public void testValidateXHTMLImageMap_EPUB3_Invalid()
EPUBVersion.VERSION_3);
}

@Test
public void testValidateXHTMLEmptyClass_EPUB2_Valid()
{
testValidateDocument("xhtml/valid/empty-class-attribute-is-valid_issue733.xhtml", "application/xhtml+xml",
EPUBVersion.VERSION_2);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>XHTML 1.1 example</title>
</head>
<body>
<h1>XHTML 1.1 example</h1>

<p>This is an example for the datatype change of the @class attribute in XHTML 1.1 (EPUB 2).</p>
<p>After the <a href="https://www.w3.org/TR/xhtml-modularization/Overview.html#status"
>latest revision of the XHTML 1.1 DTD in 2010</a> the @class attribute
allows for empty values.</p>
<p>At the time of this writing, oXygen will report this as invalid because
they also use an outdated version of the XHTML 1.1 DTD for validation.
However, this will be fixed in a future release.</p>


<div class="">
Empty @class attribute is valid
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,32 @@
<h1>XHTML 1.1 ImageMap example</h1>

<p>This is an example of an ImageMap in XHTML 1.1 (EPUB 2).</p>
<p>After the <a href="https://www.w3.org/TR/xhtml-modularization/Overview.html#status"
>latest revision of the XHTML 1.1 DTD in 2010</a> the @usemap attribute
has now datatype URIREF (basically CDATA) instead of IDREF which allows
both of the following map referencing examples whereas the first example
with a leading # is to be prefered</p>
<p>At the time of this writing, oXygen will report the first example as invalid
because they also use an outdated version of the XHTML 1.1 DTD for validation.
However, this will be fixed in a future release.</p>


<div class="map">
<img src="images/map.jpg" usemap="imagemap" width="479" height="312" alt="" />
<img src="images/map.jpg" usemap="#imagemap" width="479" height="312" alt="" />
<map id="imagemap">
<area shape="rect" coords="55,101,129,284" href="target.xhtml#t1" alt="Touch" title="Touch" />
<area shape="rect" coords="153,23,270,279" href="target.xhtml#t2" alt="Touch" title="HDPlus" />
<area shape="rect" coords="273,79,395,273" href="target.xhtml#t3" alt="Touch" title="Touch" />
</map>
</div>

<div class="map2">
<img src="images/map2.jpg" usemap="imagemap2" width="479" height="312" alt="" />
<map id="imagemap2">
<area shape="rect" coords="55,101,129,284" href="target.xhtml#t1" alt="Touch" title="Touch" />
<area shape="rect" coords="153,23,270,279" href="target.xhtml#t2" alt="Touch" title="HDPlus" />
<area shape="rect" coords="273,79,395,273" href="target.xhtml#t3" alt="Touch" title="Touch" />
</map>
</div>
</body>
</html>

0 comments on commit 4c6fb49

Please sign in to comment.