metanorma / mnconvert

Metanorma converter
2 stars 1 forks source link

Fix build with ISO Rice document #17

Open ronaldtse opened 4 years ago

ronaldtse commented 4 years ago

Error with make documents.html

java -jar target/mn2sts-1.1.jar --xml-file-in src/test/resources/iso-rice-en.cd.xml --xml-file-out documents/iso-rice-en.cd.xml
mn2sts 1.1

Input: XML (src/test/resources/iso-rice-en.cd.xml)
Output: XML (documents/iso-rice-en.cd.xml)

Transforming...
Validate XML againts XSD NISO-STS-extended-1-MathML3-XSD/NISO-STS-extended-1-mathml3.xsd...
/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml is NOT valid reason:
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 482; columnNumber: 74; cvc-complex-type.2.4.a: Invalid content was found starting with element 'break'. One of '{email, ext-link, uri, inline-supplementary-material, related-article, related-object, citation-alternatives, element-citation, mixed-citation, std, bold, fixed-case, italic, monospace, num, overline, roman, sans-serif, sc, strike, underline, ruby, alternatives, inline-graphic, private-char, chem-struct, inline-formula, tex-math, "http://www.w3.org/1998/Math/MathML":math, abbrev, index-term, index-term-range-end, milestone-end, milestone-start, named-content, styled-content, fn, target, "urn:iso:std:iso:30042:ed-1":entailedTerm, xref, std-ref, sub, sup}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 799; columnNumber: 71; cvc-complex-type.2.4.a: Invalid content was found starting with element 'admonition'. One of '{address, alternatives, array, boxed-text, chem-struct-wrap, code, fig, fig-group, graphic, media, non-normative-note, normative-note, non-normative-example, normative-example, notes-group, preformat, supplementary-material, table-wrap, table-wrap-group, disp-formula, disp-formula-group, editing-instruction, def-list, list, tex-math, "http://www.w3.org/1998/Math/MathML":math, p, related-article, related-object, disp-quote, speech, statement, verse-group, fn-group, glossary, ref-list, sec, term-sec}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1191; columnNumber: 71; cvc-complex-type.2.4.a: Invalid content was found starting with element 'admonition'. One of '{address, alternatives, array, boxed-text, chem-struct-wrap, code, fig, fig-group, graphic, media, non-normative-note, normative-note, non-normative-example, normative-example, notes-group, preformat, supplementary-material, table-wrap, table-wrap-group, disp-formula, disp-formula-group, editing-instruction, def-list, list, tex-math, "http://www.w3.org/1998/Math/MathML":math, p, related-article, related-object, disp-quote, speech, statement, verse-group, fn-group, glossary, ref-list, sec, term-sec}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1378; columnNumber: 33; cvc-complex-type.2.4.a: Invalid content was found starting with element 'xref'. One of '{disp-formula, disp-formula-group, chem-struct-wrap, fn-group, fn, disp-quote, speech, statement, verse-group, table-wrap, p, normative-note, non-normative-note, normative-example, non-normative-example, notes-group, def-list, list, alternatives, array, code, graphic, media, preformat, attrib, permissions}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1468; columnNumber: 39; cvc-complex-type.2.4.a: Invalid content was found starting with element 'fig'. One of '{alt-text, long-desc, email, ext-link, uri, disp-formula, disp-formula-group, chem-struct-wrap, fn-group, fn, disp-quote, speech, statement, verse-group, table-wrap, p, normative-note, non-normative-note, normative-example, non-normative-example, notes-group, def-list, list, alternatives, array, code, graphic, media, preformat, attrib, permissions}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1656; columnNumber: 66; cvc-complex-type.2.4.a: Invalid content was found starting with element 'source'. One of '{label, title, address, alternatives, array, boxed-text, chem-struct-wrap, code, fig, fig-group, graphic, media, non-normative-note, normative-note, non-normative-example, normative-example, notes-group, preformat, supplementary-material, table-wrap, table-wrap-group, disp-formula, disp-formula-group, editing-instruction, def-list, list, tex-math, "http://www.w3.org/1998/Math/MathML":math, p, related-article, related-object, disp-quote, speech, statement, verse-group, attrib, permissions}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1656; columnNumber: 66; cvc-complex-type.3.2.2: Attribute 'type' is not allowed to appear in element 'source'.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1656; columnNumber: 66; cvc-complex-type.3.2.2: Attribute 'bibitemid' is not allowed to appear in element 'source'.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1656; columnNumber: 66; cvc-complex-type.3.2.2: Attribute 'citeas' is not allowed to appear in element 'source'.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1660; columnNumber: 76; cvc-complex-type.2.4.a: Invalid content was found starting with element 'appendix'. One of '{address, alternatives, array, boxed-text, chem-struct-wrap, code, fig, fig-group, graphic, media, non-normative-note, normative-note, non-normative-example, normative-example, notes-group, preformat, supplementary-material, table-wrap, table-wrap-group, disp-formula, disp-formula-group, editing-instruction, def-list, list, tex-math, "http://www.w3.org/1998/Math/MathML":math, p, related-article, related-object, disp-quote, speech, statement, verse-group, fn-group, glossary, ref-list, sec, term-sec, permissions}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1665; columnNumber: 79; cvc-complex-type.2.4.a: Invalid content was found starting with element 'callout'. One of '{alt-text, long-desc, email, ext-link, uri, citation-alternatives, element-citation, mixed-citation, std, attrib, permissions, bold, fixed-case, italic, monospace, num, overline, roman, sans-serif, sc, strike, underline, ruby, inline-graphic, private-char, abbrev, index-term, index-term-range-end, milestone-end, milestone-start, named-content, styled-content, fn, target, "urn:iso:std:iso:30042:ed-1":entailedTerm, xref, sub, sup}' is expected.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1788; columnNumber: 12; cvc-id.1: There is no ID/IDREF binding for IDREF 'A.6'.
[ERROR] org.xml.sax.SAXParseException; systemId: file:/Users/mulgogi/src/mn/mn2sts/documents/iso-rice-en.cd.xml; lineNumber: 1788; columnNumber: 12; cvc-id.1: There is no ID/IDREF binding for IDREF 'B.6'.
make: *** [documents/iso-rice-en.cd.xml] Error 255
ronaldtse commented 4 years ago

It’s failing because the MN XML files need to be converted into STS XML then HTML. I missed doing this when updating the makefile. Once it is fixed the build should pass.

Intelligent2013 commented 4 years ago

@ronaldtse I've modified mn2sts.xsl to fix a few issues. For non-converted elements admonition, quote, appendix I've added simple processing into xslt (convert to sec, p elements) and created tickets: https://github.com/metanorma/mn2sts/issues/8 https://github.com/metanorma/mn2sts/issues/9 https://github.com/metanorma/mn2sts/issues/10

But iso.rice-en.xml doesn't valid against DTD ISO due the reason:

[ERROR] org.xml.sax.SAXParseException; lineNumber: 1673; columnNumber: 7; Element type "code" must be declared.
[ERROR] org.xml.sax.SAXParseException; lineNumber: 1677; columnNumber: 56; Attribute "id" must be declared for element type "annotation".
[ERROR] org.xml.sax.SAXParseException; lineNumber: 1683; columnNumber: 25; The content of element type "non-normative-example" must match "(label?,(address|alternatives|array|boxed-text|chem-struct-wrap|fig|fig-group|graphic|media|non-normative-note|non-normative-example|preformat|supplementary-material|table-wrap|table-wrap-group|disp-formula|disp-formula-group|p|def-list|list|mml:math|related-article|related-object|disp-quote|speech|statement|verse-group)*)".
[ERROR] org.xml.sax.SAXParseException; lineNumber: 1799; columnNumber: 12; An element with the identifier "_385aa053-2028-4ff6-84a9-37f06d590435" must appear in the document.

Should I turn off DTD ISO (not NISO) validation?

Intelligent2013 commented 4 years ago

Update: I've disabled DTD ISO test in junit. Let's see what is happen.