Commit 557308e 1 parent 25f28c0 commit 557308e Copy full SHA for 557308e
File tree 3 files changed +58
-2
lines changed
main/resources/com/adobe/epubcheck/schema/30
java/com/adobe/epubcheck/nav
resources/30/single/nav/invalid
3 files changed +58
-2
lines changed Original file line number Diff line number Diff line change 24
24
25
25
<pattern id =" landmarks" >
26
26
<rule context =" html:nav[tokenize(@epub:type,'\s+')='landmarks']//html:ol//html:a" >
27
- <assert test =" @epub:type" >Missing epub:type attribute on anchor inside 'landmarks' nav
28
- element</assert >
27
+ <let name =" current_type_normalized" value =" normalize-space(lower-case(@epub:type))" />
28
+ <let name =" current_href_normalized" value =" normalize-space(lower-case(@html:href))" />
29
+
30
+ <!-- Check for missing epub:type attributes -->
31
+ <assert test =" @epub:type" >Missing epub:type attribute on anchor inside 'landmarks' nav element</assert >
32
+
33
+ <!--
34
+ landmarks anchors should be unique (#493)
35
+ and only reported within the same ancestor landmarks element
36
+ -->
37
+ <assert test ="
38
+ count(ancestor::html:nav[tokenize(@epub:type,'\s+')='landmarks']//html:ol//html:a[
39
+ normalize-space(lower-case(@epub:type)) = $current_type_normalized and
40
+ normalize-space(lower-case(@html:href)) = $current_href_normalized
41
+ ]) = 1" >WARNING: Duplicate 'a' elements with the same 'epub:type' and 'href' attributes inside 'landmarks' nav element</assert >
29
42
</rule >
30
43
</pattern >
31
44
Original file line number Diff line number Diff line change @@ -172,6 +172,14 @@ public void testValidateDocumentNavLandmarks002()
172
172
testValidateDocument ("invalid/nav-landmarks-002.xhtml" );
173
173
}
174
174
175
+ @ Test
176
+ public void testValidateDocumentNavLandmarksDuplicates ()
177
+ {
178
+ // Multiple occurrences of the 'landmarks' nav element
179
+ Collections .addAll (expectedWarnings , MessageId .RSC_017 , MessageId .RSC_017 );
180
+ testValidateDocument ("invalid/nav-landmarks-duplicates.xhtml" );
181
+ }
182
+
175
183
@ Test
176
184
public void testValidateDocumentNavNoPagelist001 ()
177
185
{
Original file line number Diff line number Diff line change
1
+ < ?xml version="1.0" encoding="UTF-8"?>
2
+ < ?oxygen RNGSchema="../../../src/schema/epub-nav-30.rnc" type="compact"?>
3
+ < ?oxygen SCHSchema="../../../src/schema/epub-xhtml-30.sch"?>
4
+ < ?oxygen SCHSchema="../../../src/schema/epub-nav-30.sch"?>
5
+ < html xmlns ="http://www.w3.org/1999/xhtml " xmlns:epub ="http://www.idpf.org/2007/ops ">
6
+ < head > </ head >
7
+ < body >
8
+
9
+ < nav epub:type ="toc " id ="toc ">
10
+ <!-- the navMap -->
11
+ < h1 > Table of contents</ h1 >
12
+ < ol >
13
+ < li > < a href ="chap1.xhtml "> Chapter 1</ a >
14
+ < ol >
15
+ < li > < a href ="chap1.1.xhtml "> arbitrary XHTML Phrasing content</ a > </ li >
16
+ < li > < a href ="chap1.2.xhtml "> arbitrary XHTML Phrasing content</ a > </ li >
17
+ </ ol >
18
+ </ li >
19
+ < li > < a href ="chap1.xhtml "> Chapter 2</ a > </ li >
20
+ </ ol >
21
+ </ nav >
22
+
23
+ < nav epub:type ="landmarks ">
24
+ <!-- the guide -->
25
+ < h2 > Guide</ h2 >
26
+ < ol >
27
+ < li > < a epub:type ="toc " href ="#toc "> Table of Contents</ a > </ li >
28
+ < li > < a epub:type ="loi " href ="content.html#loi "> List of Illustrations</ a > </ li >
29
+ < li > < a epub:type ="bodymatter " href ="content.html#bodymatter "> Start of Content</ a > </ li >
30
+ < li > < a epub:type ="loi " href ="content.html#loi "> List of Illustrations</ a > </ li >
31
+ </ ol >
32
+ </ nav >
33
+
34
+ </ body >
35
+ </ html >
You can’t perform that action at this time.
0 commit comments