diff --git a/src/main/resources/xml/schema/nordic-html5.rng b/src/main/resources/xml/schema/nordic-html5.rng index 32395152..6361a6e7 100644 --- a/src/main/resources/xml/schema/nordic-html5.rng +++ b/src/main/resources/xml/schema/nordic-html5.rng @@ -365,9 +365,12 @@ The HTML root element (<html>) represents the root of an HTML document. All other elements must be descendants of this element. - - z3998: http://www.daisy.org/z3998/2012/vocab/structure/# - + + + + + + @@ -3166,6 +3169,7 @@ rearnotes + endnotes footnotes @@ -3633,6 +3637,7 @@ index-legend index-group glossary + dictionary bibliography halftitlepage @@ -3655,6 +3660,7 @@ practices footnotes rearnotes + endnotes page-list z3998:section z3998:subsection @@ -3703,6 +3709,7 @@ fulltitle + glossdef glossterm halftitle @@ -3731,7 +3738,9 @@ rearnote + endnote + subtitle @@ -3946,6 +3955,80 @@ z3998:weight + + + antonym-group + condensed-entry + def + dictentry + etymology + example + gram-info + idiom + part-of-speech + part-of-speech-group + part-of-speech-list + phonetic-transcription + phrase-group + phrase-list + sense-group + sense-list + synonym-group + tran + tran-info + + + index-editor-note + index-entry + index-entry-list + index-locator + index-locator-list + index-locator-range + index-term + index-term-categories + index-term-category + index-xref-preferred + + + + + prism:title + prism:deck + prism:subtitle + prism:byline + prism:contributors + prism:caption + prism:credit + prism:box + prism:advertisement + prism:pullQuote + msv:article-region + msv:article-text + msv:media + + + biblioref + credit + feedback + fill-in-the-blank-problem + general-problem + glossref + label + learning-objective + learning-objectives + learning-outcome + learning-outcomes + learning-resource + learning-resources + learning-standard + learning-standards + match-problem + multiple-choice-problem + ordinal + pullquote + question + referrer + true-false-problem diff --git a/src/main/resources/xml/schema/nordic2015-1.sch b/src/main/resources/xml/schema/nordic2015-1.sch index 2d425472..25a9a606 100644 --- a/src/main/resources/xml/schema/nordic2015-1.sch +++ b/src/main/resources/xml/schema/nordic2015-1.sch @@ -6,7 +6,10 @@ - + + + + @@ -169,7 +172,7 @@ - + [nordic26a] Each note must have at least one <a epub:type="noteref" ...> referencing it: @@ -180,8 +183,8 @@ - [nordic26b] The note reference with the - href "" attribute must resolve to a note, rearnote or footnote in the publication: [nordic26b] The note reference with the + href "" attribute must resolve to a note, rearnote, endnote or footnote in the publication: @@ -254,7 +257,7 @@ self::html:p[parent::html:header[parent::html:body] and tokenize(@epub:type,' ')='z3998:author'] or self::html:h1[tokenize(@epub:type,' ')='fulltitle'] or self::html:aside[tokenize(@epub:type,' ')='epigraph'] or self::html:p[tokenize(@class,' ')='line'] or self::html:*[tokenize(@class,' ')='linegroup'] or - self::html:*[self::html:ul or self::html:ol] or self::html:a[tokenize(@epub:type,' ')=('note','rearnote','footnote')] or self::html:p or + self::html:*[self::html:ul or self::html:ol] or self::html:a[tokenize(@epub:type,' ')=('note','rearnote','endnote','footnote')] or self::html:p or self::html:*[tokenize(@epub:type,' ')='z3998:poem'] or self::html:*[(self::figure or self::aside) and tokenize(@epub:type,'s')='sidebar'] or self::html:table or self::html:*[matches(local-name(),'^h\d$') and tokenize(@class,' ')='title']]" >[nordic29] Prodnote in inline context used as block element: - - [nordic128a] xmlns:nordic="http://www.mtm.se/epub/" must be defined on the root html element. + + + + [nordic128a] on the html element: the epub:prefix attribute must declare the '' prefix + [nordic128e] in the epub:prefix attribute on the html element: the namespace for the '' prefix must be '' + + + + + prefixes: + [nordic128e] all of the prefixes in use () on the element () must be declared in the epub:prefix attribute on the html element: '<html epub:prefix="">...</html> + [nordic128e] in the epub:prefix attribute on the html element: the namespaces for the prefixes must be correct. @@ -490,7 +515,7 @@ [nordic128d] nordic:supplier metadata must occur once. - + @@ -576,9 +601,9 @@ + 'z3998:publisher-address','qna','rearnotes','endnotes','revision-history','z3998:section','seriespage','subchapter','z3998:subsection','toc','toc-brief','z3998:translator-note','volume')"/> [nordic202] '' is not an allowed type in frontmatter. On elements with the epub:type "frontmatter", you can @@ -587,13 +612,18 @@ - + [nordic203a] 'rearnote' must have a section ancestor with 'rearnotes': + + [nordic203a] 'endnote' must have a section ancestor with 'endnotes': + @@ -603,6 +633,12 @@ [nordic204c] with the epub:type 'rearnotes' must have <ol> descendant elements. + + [nordic203c] with the epub:type + 'endnotes' must have descendants with 'endnote'. + [nordic204c] with the epub:type 'endnotes' must have <ol> descendant + elements. + @@ -612,9 +648,15 @@ [nordic203d] The 'notebody' class must be applied to all rearnotes: + + [nordic203d] 'endnote' can only be applied to <li> elements: + [nordic203d] The 'notebody' class must be applied to all endnotes: + - + [nordic204a] 'footnote' must have a section + 'z3998:publisher-address','qna','rearnotes','endnotes','revision-history','z3998:section','seriespage','subchapter','z3998:subsection','toc','toc-brief','z3998:translator-note','volume')"/> [nordic208] '' is not an allowed type in bodymatter. Elements with the type "bodymatter" must also have one of the types or ' + 'z3998:publisher-address','qna','rearnotes','endnotes','revision-history','z3998:section','seriespage','subchapter','z3998:subsection','toc','toc-brief','z3998:translator-note','volume')"/> + 'z3998:publisher-address','qna','rearnotes','endnotes','revision-history','z3998:section','seriespage','subchapter','z3998:subsection','toc','toc-brief','z3998:translator-note','volume')"/> [nordic215] '' is not an allowed type in backmatter. On elements with the epub:type "backmatter", you can either @@ -891,6 +933,10 @@ [nordic267a] Rearnotes must be wrapped in a "ol" element, but is currently wrapped in a : + + [nordic267a] Endnotes must be wrapped in a "ol" element, but is currently wrapped in a : + @@ -898,6 +944,10 @@ [nordic267b] List items inside a rearnotes list must use epub:type="rearnote": + + [nordic267b] List items inside a endnotes list must use epub:type="endnote": + @@ -939,18 +989,6 @@ - - - - - [nordic272a] Note reference href attribute does not contain a fragment identifier: - [nordic272b] Annotation - reference href attribute does not resolve to a note, rearnote or footnote in the publication: - - - @@ -1112,5 +1150,11 @@ select="concat('<',name(),string-join(for $a in (@*) return concat(' ',$a/name(),'="',$a,'"'),''),'>')"/> + + + + [nordic283] When using MathML with a namespace prefix, that prefix must be 'm'. Not + + diff --git a/src/main/resources/xml/xproc/step/dtbook-to-html.step.xpl b/src/main/resources/xml/xproc/step/dtbook-to-html.step.xpl index d0e5337b..c18554b3 100644 --- a/src/main/resources/xml/xproc/step/dtbook-to-html.step.xpl +++ b/src/main/resources/xml/xproc/step/dtbook-to-html.step.xpl @@ -92,6 +92,14 @@ + + + + + + + + diff --git a/src/main/resources/xml/xproc/step/epub3-to-html.step.xpl b/src/main/resources/xml/xproc/step/epub3-to-html.step.xpl index f0f5916f..aafd1580 100644 --- a/src/main/resources/xml/xproc/step/epub3-to-html.step.xpl +++ b/src/main/resources/xml/xproc/step/epub3-to-html.step.xpl @@ -1,7 +1,7 @@ - + @@ -244,6 +244,9 @@ + + + @@ -252,7 +255,7 @@ - + @@ -264,6 +267,14 @@ + + + + + + + + diff --git a/src/main/resources/xml/xslt/deep-level-grouping.xsl b/src/main/resources/xml/xslt/deep-level-grouping.xsl index e7901a2c..1476ba8f 100644 --- a/src/main/resources/xml/xslt/deep-level-grouping.xsl +++ b/src/main/resources/xml/xslt/deep-level-grouping.xsl @@ -63,7 +63,7 @@ - + @@ -157,11 +157,11 @@ - + - + @@ -172,8 +172,8 @@ - - + + @@ -193,7 +193,7 @@ - + @@ -204,8 +204,8 @@ - - + + @@ -224,7 +224,7 @@ - + diff --git a/src/main/resources/xml/xslt/dtbook-legacy-fix.xsl b/src/main/resources/xml/xslt/dtbook-legacy-fix.xsl index c36d199f..cfda82d3 100644 --- a/src/main/resources/xml/xslt/dtbook-legacy-fix.xsl +++ b/src/main/resources/xml/xslt/dtbook-legacy-fix.xsl @@ -24,7 +24,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -109,7 +109,7 @@ - + diff --git a/src/main/resources/xml/xslt/dtbook-to-epub3.xsl b/src/main/resources/xml/xslt/dtbook-to-epub3.xsl index c1a7615c..93449a43 100644 --- a/src/main/resources/xml/xslt/dtbook-to-epub3.xsl +++ b/src/main/resources/xml/xslt/dtbook-to-epub3.xsl @@ -1,7 +1,15 @@ - + @@ -127,8 +135,8 @@ - - + + @@ -144,11 +152,12 @@ - + + @@ -284,6 +293,7 @@ <xsl:template match="dtbook:meta"> <xsl:choose> + <xsl:when test="starts-with(@name,'dtb:')"/> <xsl:when test="matches(@name,'dc:title','i') or matches(@name,'dc:identifier','i') or matches(@name,'dc:format','i') or starts-with(@name,'track:')"/> <xsl:otherwise> <meta> @@ -309,6 +319,7 @@ <xsl:template match="dtbook:book"> <body> + <xsl:copy-of select="namespace::*[not(.='http://www.daisy.org/z3986/2005/dtbook/')]" exclude-result-prefixes="#all"/> <xsl:call-template name="f:attlist.book"/> <xsl:apply-templates select="node()"/> </body> diff --git a/src/main/resources/xml/xslt/dtbook2005-to-dtbook110.xsl b/src/main/resources/xml/xslt/dtbook2005-to-dtbook110.xsl index 6bfb852d..3aef6c16 100644 --- a/src/main/resources/xml/xslt/dtbook2005-to-dtbook110.xsl +++ b/src/main/resources/xml/xslt/dtbook2005-to-dtbook110.xsl @@ -529,7 +529,7 @@ <xsl:value-of select="@id"/> <xsl:text>'></xsl:text> <xsl:variable name="nodeAsStr" select="string(.)"/> - <xsl:copy-of select="$nodeAsStr"/> + <xsl:copy-of select="$nodeAsStr" exclude-result-prefixes="#all"/> <xsl:text></pagenum></xsl:text> </xsl:comment> </xsl:when> diff --git a/src/main/resources/xml/xslt/epub3-to-dtbook.xsl b/src/main/resources/xml/xslt/epub3-to-dtbook.xsl index fea2a1e6..a36daf47 100644 --- a/src/main/resources/xml/xslt/epub3-to-dtbook.xsl +++ b/src/main/resources/xml/xslt/epub3-to-dtbook.xsl @@ -851,7 +851,7 @@ </xsl:template> <xsl:template name="f:attlist.noteref"> - <xsl:if test="@class or f:types(.)[not(.='noteref')]"> + <xsl:if test="f:classes(.)[not(.='noteref')] or f:types(.)[not(.='noteref')]"> <xsl:message select="'the class attribute on a noteref was dropped since it is not allowed in Nordic DTBook.'"/> </xsl:if> <xsl:call-template name="f:attrs"> diff --git a/src/main/resources/xml/xslt/epub3-vocab.xsl b/src/main/resources/xml/xslt/epub3-vocab.xsl index 0fb8968d..fccc22ec 100644 --- a/src/main/resources/xml/xslt/epub3-vocab.xsl +++ b/src/main/resources/xml/xslt/epub3-vocab.xsl @@ -2,7 +2,7 @@ <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="vocab-default" - select="('cover','frontmatter','bodymatter','backmatter','volume','part','chapter','subchapter','division','abstract','foreword','preface','prologue','introduction','preamble','conclusion','epilogue','afterword','epigraph','toc','toc-brief','landmarks','loa','loi','lot','lov','appendix','colophon','credits','keywords','index','index-headnotes','index-legend','index-group','index-entry-list','index-entry','index-term','index-editor-note','index-locator','index-locator-list','index-locator-range','index-xref-preferred','index-xref-related','index-term-category','index-term-categories','glossary','glossterm','glossdef','bibliography','biblioentry','titlepage','halftitlepage','copyright-page','seriespage ','acknowledgments','imprint','imprimatur','contributors','other-credits','errata','dedication','revision-history','case-study','help','marginalia','notice','pullquote','sidebar','warning','halftitle','fulltitle','covertitle','title','subtitle','label','ordinal','bridgehead','learning-objective','learning-objectives','learning-outcome','learning-outcomes','learning-resource','learning-resources','learning-standard','learning-standards','answer','answers','assessment','assessments','feedback','fill-in-the-blank-problem','general-problem','qna','match-problem','multiple-choice-problem','practice','practices','question','true-false-problem','panel','panel-group','balloon','text-area','sound-area','annotation','note','footnote','rearnote','footnotes','rearnotes','annoref','biblioref','glossref','noteref','referrer','credit','keyword','topic-sentence','concluding-sentence','pagebreak','page-list','table','table-row','table-cell','list','list-item','figure')"/> + select="('cover','frontmatter','bodymatter','backmatter','volume','part','chapter','subchapter','division','abstract','foreword','preface','prologue','introduction','preamble','conclusion','epilogue','afterword','epigraph','toc','toc-brief','landmarks','loa','loi','lot','lov','appendix','colophon','credits','keywords','index','index-headnotes','index-legend','index-group','index-entry-list','index-entry','index-term','index-editor-note','index-locator','index-locator-list','index-locator-range','index-xref-preferred','index-xref-related','index-term-category','index-term-categories','glossary','glossterm','glossdef','dictionary','bibliography','biblioentry','titlepage','halftitlepage','copyright-page','seriespage ','acknowledgments','imprint','imprimatur','contributors','other-credits','errata','dedication','revision-history','case-study','help','marginalia','notice','pullquote','sidebar','warning','halftitle','fulltitle','covertitle','title','subtitle','label','ordinal','bridgehead','learning-objective','learning-objectives','learning-outcome','learning-outcomes','learning-resource','learning-resources','learning-standard','learning-standards','answer','answers','assessment','assessments','feedback','fill-in-the-blank-problem','general-problem','qna','match-problem','multiple-choice-problem','practice','practices','question','true-false-problem','panel','panel-group','balloon','text-area','sound-area','annotation','note','footnote','rearnote','footnotes','rearnotes','endnotes','annoref','biblioref','glossref','noteref','referrer','credit','keyword','topic-sentence','concluding-sentence','pagebreak','page-list','table','table-row','table-cell','list','list-item','figure','antonym-group','condensed-entry','def','dictentry','endnote','etymology','example','gram-info','idiom','part-of-speech','part-of-speech-group','part-of-speech-list','phonetic-transcription','phrase-group','phrase-list','sense-group','sense-list','seriespage','synonym-group','tran','tran-info')"/> <xsl:variable name="vocab-z3998-uri" select="'http://www.daisy.org/z3998/2012/vocab/structure/#'"/> <xsl:variable name="vocab-z3998" diff --git a/src/main/resources/xml/xslt/epubcheck-report-to-pipeline-report.xsl b/src/main/resources/xml/xslt/epubcheck-report-to-pipeline-report.xsl index be86fc08..427fcd38 100644 --- a/src/main/resources/xml/xslt/epubcheck-report-to-pipeline-report.xsl +++ b/src/main/resources/xml/xslt/epubcheck-report-to-pipeline-report.xsl @@ -139,7 +139,7 @@ <xsl:for-each select="distinct-values($messages/*/local-name())"> <xsl:variable name="name" select="."/> <xsl:element name="d:{if ($name='exception') then 'exceptions' else if ($name='error') then 'errors' else if ($name='warn') then 'warnings' else 'hints'}"> - <xsl:copy-of select="$messages/*[local-name()=$name]"/> + <xsl:copy-of select="$messages/*[local-name()=$name]" exclude-result-prefixes="#all"/> </xsl:element> </xsl:for-each> </d:report> diff --git a/src/main/resources/xml/xslt/fix-section-hierarchy.xsl b/src/main/resources/xml/xslt/fix-section-hierarchy.xsl index 5edae8ad..430f38d1 100644 --- a/src/main/resources/xml/xslt/fix-section-hierarchy.xsl +++ b/src/main/resources/xml/xslt/fix-section-hierarchy.xsl @@ -5,7 +5,7 @@ <xsl:param name="body-is-section" required="yes"/> <xsl:template match="@*|node()"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> diff --git a/src/main/resources/xml/xslt/generate-missing-headlines.xsl b/src/main/resources/xml/xslt/generate-missing-headlines.xsl index 4a918ee8..0cf6ec74 100644 --- a/src/main/resources/xml/xslt/generate-missing-headlines.xsl +++ b/src/main/resources/xml/xslt/generate-missing-headlines.xsl @@ -12,7 +12,7 @@ <xsl:variable name="translations" select="document('../i18n/translations.xml')/*"/> <xsl:template match="@*|node()"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> @@ -75,7 +75,7 @@ <xsl:message select="$title"/> <xsl:message select="('en',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()]"/> <xsl:variable name="translated-title" select="pf:i18n-translate($title,('en',ancestor-or-self::*[@xml:lang|@lang]/(@xml:lang|@lang)[1])[last()],$translations)"/> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*"/> <xsl:if test="not(h1 | h2 | h3 | h4 | h5 | h6)"> <!-- sectioning element is missing headline; let's generate one! --> diff --git a/src/main/resources/xml/xslt/html-to-opf-metadata.xsl b/src/main/resources/xml/xslt/html-to-opf-metadata.xsl index ceccadc2..fe389859 100644 --- a/src/main/resources/xml/xslt/html-to-opf-metadata.xsl +++ b/src/main/resources/xml/xslt/html-to-opf-metadata.xsl @@ -7,7 +7,7 @@ <xsl:variable name="identifier" select="//html:head/html:meta[lower-case(@name)=('dc:identifier','dct:identifier','dcterms:identifier','dtb:uid')][1]"/> <dc:identifier id="pub-id"> - <xsl:copy-of select="$identifier/@scheme"/> + <xsl:copy-of select="$identifier/@scheme" exclude-result-prefixes="#all"/> <xsl:value-of select="($identifier/@content,replace(replace(string(current-dateTime()),'\+.*',''),'[^\d]',''))[1]"/> </dc:identifier> @@ -37,7 +37,7 @@ <xsl:when test="matches($lcname,'^dc:')"> <xsl:element name="{$lcname}"> <xsl:attribute name="id" select="$id"/> - <xsl:copy-of select="@scheme"/> + <xsl:copy-of select="@scheme" exclude-result-prefixes="#all"/> <xsl:value-of select="@content"/> </xsl:element> <xsl:if test="@role"> @@ -49,14 +49,14 @@ <xsl:when test="matches($lcname,'^dct:') or matches($lcname,'^dcterms:')"> <meta property="{replace($lcname,'^dct:','dcterms:')}"> <xsl:attribute name="id" select="$id"/> - <xsl:copy-of select="@scheme"/> + <xsl:copy-of select="@scheme" exclude-result-prefixes="#all"/> <xsl:value-of select="@content"/> </meta> </xsl:when> <xsl:when test="@name='dtb:narrator'"> <dc:contributor id="{$id}"> <xsl:attribute name="id" select="$id"/> - <xsl:copy-of select="@scheme"/> + <xsl:copy-of select="@scheme" exclude-result-prefixes="#all"/> <xsl:value-of select="@content"/> </dc:contributor> <meta refines="#{$id}" property="role" scheme="marc:relators">nrt</meta> @@ -64,7 +64,7 @@ <xsl:when test="@name='dtb:producer'"> <dc:contributor id="{$id}"> <xsl:attribute name="id" select="$id"/> - <xsl:copy-of select="@scheme"/> + <xsl:copy-of select="@scheme" exclude-result-prefixes="#all"/> <xsl:value-of select="@content"/> </dc:contributor> <meta refines="#{$id}" property="role" scheme="marc:relators">pro</meta> @@ -80,7 +80,7 @@ <xsl:otherwise> <meta property="{@name}"> <xsl:attribute name="id" select="$id"/> - <xsl:copy-of select="@scheme"/> + <xsl:copy-of select="@scheme" exclude-result-prefixes="#all"/> <xsl:value-of select="@content"/> </meta> </xsl:otherwise> diff --git a/src/main/resources/xml/xslt/improve-html-report-readability.xsl b/src/main/resources/xml/xslt/improve-html-report-readability.xsl index 0d8fb87c..18f21e91 100644 --- a/src/main/resources/xml/xslt/improve-html-report-readability.xsl +++ b/src/main/resources/xml/xslt/improve-html-report-readability.xsl @@ -14,23 +14,23 @@ --> <xsl:template match="@* | node()"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="@class[tokenize(.,'\s+')=('error','fatal','exception','message-error','message-fatal','message-exception')]"> - <xsl:copy-of select="."/> + <xsl:copy-of select="." exclude-result-prefixes="#all"/> <xsl:attribute name="style" select="concat(parent::*/@style, 'background-color: #f2dede; ')"/> </xsl:template> <xsl:template match="@class[tokenize(.,'\s+')=('warn','warning','message-warn','message-warning')]"> - <xsl:copy-of select="."/> + <xsl:copy-of select="." exclude-result-prefixes="#all"/> <xsl:attribute name="style" select="concat(parent::*/@style, 'background-color: #fcf8e3; ')"/> </xsl:template> <xsl:template match="li[.//pre[starts-with(text(),'/*')]]"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*"/> <xsl:attribute name="title" select="replace(replace((.//pre[starts-with(text(),'/*')]/text())[1],'\*:',''),'\[namespace[^\]]*\]','')"/> <xsl:apply-templates select="node()"/> @@ -40,7 +40,7 @@ <xsl:template match="pre[starts-with(text(),'/*')]"/> <xsl:template match="h2[ancestor::div[@class='document-validation-report']]"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*"/> <xsl:attribute name="style" select="string-join((@style,'font-size: 24px;'),' ')"/> <xsl:apply-templates select="node()"/> @@ -56,7 +56,7 @@ <xsl:template match="h3[text()='Location (XPath)']" priority="2"/> <xsl:template match="h3[ancestor::div[@class='document-validation-report']]"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*"/> <xsl:attribute name="style" select="string-join((@style,'font-size: 18px;'),' ')"/> <xsl:apply-templates select="node()"/> @@ -64,7 +64,7 @@ </xsl:template> <xsl:template match="p[text()='0 issues found.']"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*"/> <xsl:attribute name="style" select="string-join((@style, 'background-color: #AAFFAA;'),' ')"/> <xsl:apply-templates select="node()"/> @@ -78,7 +78,7 @@ <xsl:variable name="columnNumber" select="replace($parts[starts-with(.,'columnNumber:')][1],'[^\d]','')"/> <xsl:variable name="message" select="string-join($parts[not(starts-with(.,'org.xml.sax.SAXParseException') or starts-with(.,'systemId:') or starts-with(.,'lineNumber:') or starts-with(.,'columnNumber:'))],'; ')"/> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*"/> <xsl:value-of select="$filename"/> <xsl:if test="$lineNumber or $columnNumber"> @@ -96,14 +96,14 @@ <xsl:template match="ul[.//text()[contains(., 'lineNumber')]]"> <p>Note that line numbers tend to be offset by a couple of lines because the doctype and xml declarations are not counted as lines.</p> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="div[@class='document-validation-report' and count(*)=0]" priority="2"/> <xsl:template match="div[@class='document-validation-report']"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@* | node()"/> <hr/> </xsl:copy> diff --git a/src/main/resources/xml/xslt/info-report.xsl b/src/main/resources/xml/xslt/info-report.xsl index 7cf4caa2..6a2a55f3 100644 --- a/src/main/resources/xml/xslt/info-report.xsl +++ b/src/main/resources/xml/xslt/info-report.xsl @@ -29,15 +29,15 @@ </xsl:variable> <xsl:for-each select="$types/*"> <xsl:sort select="xs:integer(@content)"/> - <xsl:copy-of select="."/> + <xsl:copy-of select="." exclude-result-prefixes="#all"/> </xsl:for-each> <xsl:for-each select="$classes/*"> <xsl:sort select="xs:integer(@content)"/> - <xsl:copy-of select="."/> + <xsl:copy-of select="." exclude-result-prefixes="#all"/> </xsl:for-each> <xsl:for-each select="$elements/*"> <xsl:sort select="xs:integer(@content)"/> - <xsl:copy-of select="."/> + <xsl:copy-of select="." exclude-result-prefixes="#all"/> </xsl:for-each> </d:properties> </d:document-info> diff --git a/src/main/resources/xml/xslt/make-uris-relative-to-document.xsl b/src/main/resources/xml/xslt/make-uris-relative-to-document.xsl index b9e4b535..1b857f5f 100644 --- a/src/main/resources/xml/xslt/make-uris-relative-to-document.xsl +++ b/src/main/resources/xml/xslt/make-uris-relative-to-document.xsl @@ -5,7 +5,7 @@ <xsl:variable name="doc-base" select="if (/html/head/base[@href][1]) then resolve-uri(normalize-space(/html/head/base[@href][1]/@href),base-uri(/*)) else base-uri(/*)"/> <xsl:template match="/*|@*|node()"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> @@ -18,7 +18,7 @@ <xsl:attribute name="{name()}" select="concat('#',substring-after(.,'#'))"/> </xsl:when> <xsl:otherwise> - <xsl:copy-of select="."/> + <xsl:copy-of select="." exclude-result-prefixes="#all"/> </xsl:otherwise> </xsl:choose> </xsl:template> diff --git a/src/main/resources/xml/xslt/navdoc-nordic-normalization.xsl b/src/main/resources/xml/xslt/navdoc-nordic-normalization.xsl index 509fbd7e..21274e90 100644 --- a/src/main/resources/xml/xslt/navdoc-nordic-normalization.xsl +++ b/src/main/resources/xml/xslt/navdoc-nordic-normalization.xsl @@ -1,27 +1,35 @@ <?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="2.0" xmlns:epub="http://www.idpf.org/2007/ops" - xmlns="http://www.w3.org/1999/xhtml" xpath-default-namespace="http://www.w3.org/1999/xhtml"> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:epub="http://www.idpf.org/2007/ops" + xmlns:f="http://www.daisy.org/ns/pipeline/internal-functions" + xmlns="http://www.w3.org/1999/xhtml" + xpath-default-namespace="http://www.w3.org/1999/xhtml" + exclude-result-prefixes="#all" + version="2.0"> <xsl:param name="identifier" required="yes"/> <xsl:param name="title" required="yes"/> <xsl:param name="supplier" select="''"/> <xsl:param name="publisher" required="yes"/> <xsl:variable name="lang" select="string((/html/head/meta[@name='dc:language']/@content, /*/@xml:lang, /*/@lang)[1])"/> + + <xsl:include href="update-epub-prefixes.xsl"/> <xsl:template match="@*|node()"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:apply-templates select="@*[not(name()=('lang','xml:lang'))] | node()"/> </xsl:copy> </xsl:template> <xsl:template match="/*"> - <xsl:copy> + <xsl:copy exclude-result-prefixes="#all"> <xsl:namespace name="epub" select="'http://www.idpf.org/2007/ops'"/> - <xsl:namespace name="nordic" select="'http://www.mtm.se/epub/'"/> <xsl:apply-templates select="@*[not(name()=('lang','xml:lang'))]"/> <xsl:attribute name="xml:lang" select="$lang"/> <xsl:attribute name="lang" select="$lang"/> - <xsl:attribute name="epub:prefix" select="'z3998: http://www.daisy.org/z3998/2012/vocab/structure/#'"/> + <xsl:variable name="prefixes" select="f:prefixes(/*/head, /*/body, 'nordic')"/> + <xsl:attribute name="epub:prefix" select="string-join($prefixes, ' ')"/> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> diff --git a/src/main/resources/xml/xslt/navdoc-to-outline.xsl b/src/main/resources/xml/xslt/navdoc-to-outline.xsl index e149500f..86e6db12 100644 --- a/src/main/resources/xml/xslt/navdoc-to-outline.xsl +++ b/src/main/resources/xml/xslt/navdoc-to-outline.xsl @@ -10,11 +10,13 @@ </xsl:template> <xsl:template match="/*"> - <xsl:copy> - <xsl:attribute name="xml:base" select="base-uri(/*)"/> - <xsl:attribute name="epub:prefix" select="'z3998: http://www.daisy.org/z3998/2012/vocab/structure/#'"/> - <xsl:namespace name="nordic" select="'http://www.mtm.se/epub/'"/> + <xsl:copy exclude-result-prefixes="#all"> + <xsl:copy-of select="(/* | opf:*)/namespace::*[not(.=('http://www.idpf.org/2007/opf','http://purl.org/dc/elements/1.1/','http://purl.org/dc/terms/'))]"/> <xsl:namespace name="epub" select="'http://www.idpf.org/2007/ops'"/> + <xsl:attribute name="xml:base" select="base-uri(/*)"/> + <xsl:if test="@prefix"> + <xsl:attribute name="epub:prefix" select="string-join((/* | opf:*)/@prefix, ' ')"/> + </xsl:if> <head/> <body> @@ -23,8 +25,8 @@ <xsl:variable name="basedir" select="replace(base-uri(),'[^/]+$','')"/> <xsl:variable name="spine-annotated"> <xsl:for-each select="$spine"> - <xsl:copy> - <xsl:copy-of select="@*"/> + <xsl:copy exclude-result-prefixes="#all"> + <xsl:copy-of select="@*" exclude-result-prefixes="#all"/> <xsl:attribute name="level" select="pf:outline-level($spine, $toc, position())"/> </xsl:copy> </xsl:for-each> @@ -95,7 +97,7 @@ <xsl:template match="span"> <xsl:element name="{concat('h',min((count(ancestor::li),6)))}"> - <xsl:copy-of select="(@*|node())"/> + <xsl:copy-of select="(@*|node())" exclude-result-prefixes="#all"/> </xsl:element> </xsl:template> diff --git a/src/main/resources/xml/xslt/opf-to-html-metadata.xsl b/src/main/resources/xml/xslt/opf-to-html-metadata.xsl index 20863721..bd4e8780 100644 --- a/src/main/resources/xml/xslt/opf-to-html-metadata.xsl +++ b/src/main/resources/xml/xslt/opf-to-html-metadata.xsl @@ -11,15 +11,18 @@ <xsl:template match="opf:metadata"> <xsl:text> </xsl:text> - <head xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:nordic="http://www.mtm.se/epub/"> - <xsl:copy-of select="namespace::*[not(.=('http://www.w3.org/1999/xhtml','http://www.idpf.org/2007/opf'))]"/> + <head xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:nordic="http://www.mtm.se/epub/" xmlns:epub="http://www.idpf.org/2007/ops"> + <xsl:copy-of select="namespace::*[not(.=('http://www.w3.org/1999/xhtml','http://www.idpf.org/2007/opf'))]" exclude-result-prefixes="#all"/> + <xsl:if test="count(ancestor-or-self::*/@prefix)"> + <xsl:attribute name="epub:prefix" select="string-join(ancestor-or-self::*/@prefix, ' ')"/> + </xsl:if> <xsl:text> </xsl:text> <meta charset="UTF-8"/> <xsl:text> </xsl:text> <title> - <xsl:copy-of select="dc:title[1]/(@scheme|@http-equiv|@xml:lang|@dir|namespace::*[not(.=('http://www.w3.org/1999/xhtml','http://www.idpf.org/2007/opf'))]|node())"/> + <xsl:copy-of select="dc:title[1]/(@scheme|@http-equiv|@xml:lang|@dir|namespace::*[not(.=('http://www.w3.org/1999/xhtml','http://www.idpf.org/2007/opf'))]|node())" exclude-result-prefixes="#all"/> @@ -37,7 +40,7 @@ - + @@ -46,7 +49,7 @@ - + diff --git a/src/main/resources/xml/xslt/pretty-print.xsl b/src/main/resources/xml/xslt/pretty-print.xsl index 7561915f..a5f16819 100644 --- a/src/main/resources/xml/xslt/pretty-print.xsl +++ b/src/main/resources/xml/xslt/pretty-print.xsl @@ -22,7 +22,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/src/main/resources/xml/xslt/replace-sections-with-documents.xsl b/src/main/resources/xml/xslt/replace-sections-with-documents.xsl index 4f3ca479..78b3b109 100644 --- a/src/main/resources/xml/xslt/replace-sections-with-documents.xsl +++ b/src/main/resources/xml/xslt/replace-sections-with-documents.xsl @@ -1,9 +1,16 @@ - + + + @@ -27,6 +34,19 @@ + + + + + + + + + + + + + diff --git a/src/main/resources/xml/xslt/replace-single-html-hrefs-with-multi-html-hrefs.xsl b/src/main/resources/xml/xslt/replace-single-html-hrefs-with-multi-html-hrefs.xsl index 11830197..379e9dcd 100644 --- a/src/main/resources/xml/xslt/replace-single-html-hrefs-with-multi-html-hrefs.xsl +++ b/src/main/resources/xml/xslt/replace-single-html-hrefs-with-multi-html-hrefs.xsl @@ -9,7 +9,7 @@ - + @@ -19,7 +19,7 @@ - + diff --git a/src/main/resources/xml/xslt/split-html.annotate.xsl b/src/main/resources/xml/xslt/split-html.annotate.xsl index 6b41eeda..f3cb9e53 100644 --- a/src/main/resources/xml/xslt/split-html.annotate.xsl +++ b/src/main/resources/xml/xslt/split-html.annotate.xsl @@ -13,39 +13,39 @@ - - + + - + - - + + - + - + - + - + - + diff --git a/src/main/resources/xml/xslt/split-html.xsl b/src/main/resources/xml/xslt/split-html.xsl index 66500fa4..a35cda22 100644 --- a/src/main/resources/xml/xslt/split-html.xsl +++ b/src/main/resources/xml/xslt/split-html.xsl @@ -1,13 +1,23 @@ - + + - + @@ -17,23 +27,28 @@ + - - + + + + + + - + - + @@ -84,7 +99,7 @@ - + diff --git a/src/main/resources/xml/xslt/update-epub-prefixes.xsl b/src/main/resources/xml/xslt/update-epub-prefixes.xsl new file mode 100644 index 00000000..abb7e89c --- /dev/null +++ b/src/main/resources/xml/xslt/update-epub-prefixes.xsl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/C00000.epub b/src/test/resources/C00000.epub index e723eb2e..acef2993 100644 Binary files a/src/test/resources/C00000.epub and b/src/test/resources/C00000.epub differ diff --git a/src/test/resources/C00000/EPUB/C00000-04-chapter.xhtml b/src/test/resources/C00000/EPUB/C00000-04-chapter.xhtml index e43dab62..33ae3392 100644 --- a/src/test/resources/C00000/EPUB/C00000-04-chapter.xhtml +++ b/src/test/resources/C00000/EPUB/C00000-04-chapter.xhtml @@ -2,7 +2,7 @@ - diff --git a/src/test/resources/DTBook/C00000.xml b/src/test/resources/DTBook/C00000.xml index 01c69792..cf680f5b 100644 --- a/src/test/resources/DTBook/C00000.xml +++ b/src/test/resources/DTBook/C00000.xml @@ -3,7 +3,7 @@ - + diff --git a/src/test/resources/single-html/C00000.xhtml b/src/test/resources/single-html/C00000.xhtml index c2b5b800..93e7bf72 100644 --- a/src/test/resources/single-html/C00000.xhtml +++ b/src/test/resources/single-html/C00000.xhtml @@ -2,7 +2,7 @@ - diff --git a/src/test/xprocspec/dtbook-to-epub3.xprocspec b/src/test/xprocspec/dtbook-to-epub3.xprocspec index 25a14914..e2e97284 100644 --- a/src/test/xprocspec/dtbook-to-epub3.xprocspec +++ b/src/test/xprocspec/dtbook-to-epub3.xprocspec @@ -41,8 +41,6 @@ label="There should be exactly four namespaces declared on the root element (the default namespace, nordic, epub and the implicit xml namespace)"/> - - + ... ... @@ -92,8 +92,8 @@ - - ... + + ... @@ -4274,5 +4274,12 @@ + + + + + + + diff --git a/src/test/xspec/navdoc-to-outline.xspec b/src/test/xspec/navdoc-to-outline.xspec index 4e578cb1..2234d661 100644 --- a/src/test/xspec/navdoc-to-outline.xspec +++ b/src/test/xspec/navdoc-to-outline.xspec @@ -4,8 +4,7 @@ - +
@@ -23,8 +22,7 @@ - +
diff --git a/src/test/xspec/opf-to-html-metadata.xspec b/src/test/xspec/opf-to-html-metadata.xspec index 7695e25b..8aec6334 100644 --- a/src/test/xspec/opf-to-html-metadata.xspec +++ b/src/test/xspec/opf-to-html-metadata.xspec @@ -1,12 +1,14 @@ - + - + Valentin Haüy - the father of the education for the blind diff --git a/src/test/xspec/replace-sections-with-documents.xspec b/src/test/xspec/replace-sections-with-documents.xspec index 3212d371..902eda6a 100644 --- a/src/test/xspec/replace-sections-with-documents.xspec +++ b/src/test/xspec/replace-sections-with-documents.xspec @@ -5,8 +5,7 @@ - +
@@ -45,7 +44,7 @@
- + cover @@ -55,7 +54,7 @@

lorem ipsum

- + introduction @@ -65,7 +64,7 @@

lorem ipsum

- + rearnotes @@ -75,7 +74,7 @@

lorem ipsum

- + chapter @@ -85,7 +84,7 @@

lorem ipsum

- + part @@ -95,7 +94,7 @@

lorem ipsum

- + rearnotes @@ -105,7 +104,7 @@

lorem ipsum

- + introduction @@ -115,7 +114,7 @@

lorem ipsum

- + rearnotes @@ -125,7 +124,7 @@

lorem ipsum

- + chapter @@ -135,9 +134,10 @@

lorem ipsum

- + rearnotes + @@ -145,7 +145,7 @@

lorem ipsum

- + part @@ -155,7 +155,7 @@

lorem ipsum

- + chapter @@ -165,7 +165,7 @@

lorem ipsum

- + part @@ -175,7 +175,7 @@

lorem ipsum

- + chapter @@ -185,7 +185,7 @@

lorem ipsum

- + chapter @@ -195,7 +195,7 @@

lorem ipsum

- + rearnotes @@ -205,7 +205,7 @@

lorem ipsum

- + chapter @@ -215,7 +215,7 @@

lorem ipsum

- + part @@ -225,7 +225,7 @@

lorem ipsum

- + part @@ -235,7 +235,7 @@

lorem ipsum

- + chapter @@ -245,7 +245,7 @@

lorem ipsum

- + rearnotes @@ -255,7 +255,7 @@

lorem ipsum

- + chapter @@ -265,7 +265,7 @@

lorem ipsum

- + index @@ -275,7 +275,7 @@

lorem ipsum

- + rearnotes @@ -285,7 +285,7 @@

lorem ipsum

- + footnotes @@ -298,8 +298,7 @@ - +
diff --git a/src/test/xspec/split-html.xspec b/src/test/xspec/split-html.xspec index 5cd3e755..c3a7a7d6 100644 --- a/src/test/xspec/split-html.xspec +++ b/src/test/xspec/split-html.xspec @@ -1,12 +1,16 @@ - - + + - + Single-page title +
@@ -16,6 +20,7 @@

titlepage

titlepagetitlepagetitlepage

+

author

colophon

@@ -78,9 +83,10 @@ - + Single-page title + @@ -88,20 +94,23 @@

covercovercover

- + Single-page title +

titlepage

titlepagetitlepagetitlepage

+

author

- + Single-page title + @@ -110,9 +119,10 @@

colophoncolophoncolophon

- + Single-page title + @@ -121,9 +131,10 @@

toctoctoc

- + Single-page title + @@ -132,9 +143,10 @@

partpartpart

- + Single-page title + @@ -143,9 +155,10 @@

chapterchapterchapter

- + Single-page title + @@ -154,9 +167,10 @@

chapterchapterchapter

- + Single-page title + @@ -165,9 +179,10 @@

partpartpart

- + Single-page title + @@ -176,9 +191,10 @@

chapterchapterchapter

- + Single-page title + @@ -187,9 +203,10 @@

chapterchapterchapter

- + Single-page title + @@ -198,9 +215,10 @@

indexindexindex

- + Single-page title + @@ -209,9 +227,10 @@

appendixappendixappendix

- + Single-page title + @@ -220,9 +239,10 @@

appendixappendixappendix

- + Single-page title + @@ -231,9 +251,10 @@

glossaryglossaryglossary

- + Single-page title + @@ -242,9 +263,10 @@

footnotesfootnotesfootnotes

- + Single-page title + @@ -258,7 +280,7 @@ - + Single-page title @@ -283,7 +305,7 @@ - + Single-page title @@ -300,7 +322,7 @@ - + Single-page title diff --git a/src/test/xspec/update-epub-prefixes.xspec b/src/test/xspec/update-epub-prefixes.xspec new file mode 100644 index 00000000..789dc465 --- /dev/null +++ b/src/test/xspec/update-epub-prefixes.xspec @@ -0,0 +1,72 @@ + + + + + + + + + + + + +

+ + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +