diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-switch.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-switch.rnc index 13b834df5..0fe919dbd 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-switch.rnc +++ b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-switch.rnc @@ -1,5 +1,7 @@ namespace epub = "http://www.idpf.org/2007/ops" + namespace m = "http://www.w3.org/1998/Math/MathML" + namespace h = "http://www.w3.org/1999/xhtml" common.elem.flow |= epub.switch.flow common.elem.phrasing |= epub.switch.phrasing @@ -14,7 +16,7 @@ epub.case.flow.content = epub.switch.any epub.case.phrasing.content = epub.switch.any - epub.switch.any = (epub.switch.anyElement | text)* + epub.switch.any = (common.elem.flow | epub.switch.anyElement | text)* epub.default.flow.content = common.inner.flow epub.default.phrasing.content = common.inner.phrasing @@ -25,8 +27,10 @@ epub.case.rn.attr = attribute required-namespace { datatype.URI } - epub.switch.anyElement = element * { + epub.switch.anyElement = element * - (m:* | h:*) { (attribute * { text } | text - | epub.switch.anyElement)* + | epub.switch.anyElement + | common.elem.flow + )* } \ No newline at end of file diff --git a/src/test/java/com/adobe/epubcheck/ops/OPSCheckerTest.java b/src/test/java/com/adobe/epubcheck/ops/OPSCheckerTest.java index e239b61ed..ad8575cb7 100644 --- a/src/test/java/com/adobe/epubcheck/ops/OPSCheckerTest.java +++ b/src/test/java/com/adobe/epubcheck/ops/OPSCheckerTest.java @@ -321,6 +321,14 @@ public void testValidateXHTMLSwitch001() testValidateDocument("xhtml/valid/switch-001.xhtml", "application/xhtml+xml", EPUBVersion.VERSION_3); } + + @Test + public void testValidateXHTMLSwitchMathCase() + { + Collections.addAll(expectedErrors, MessageId.RSC_005); + testValidateDocument("xhtml/invalid/switch-invalid-mathml.xhtml", "application/xhtml+xml", + EPUBVersion.VERSION_3); + } @Test public void testValidateXHTMLTables001() diff --git a/src/test/resources/30/single/xhtml/invalid/switch-invalid-mathml.xhtml b/src/test/resources/30/single/xhtml/invalid/switch-invalid-mathml.xhtml new file mode 100644 index 000000000..e628f7e17 --- /dev/null +++ b/src/test/resources/30/single/xhtml/invalid/switch-invalid-mathml.xhtml @@ -0,0 +1,27 @@ + + + + MathML invalid 001 + + + +

nested math tags should be invalid even inside epub switch

+ + + + + 11 + , + + 3 + , + 5 + + + + + + + +