Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OT 2.x and 1.x #58

Open
drmacro opened this issue Dec 17, 2015 · 4 comments
Open

Support OT 2.x and 1.x #58

drmacro opened this issue Dec 17, 2015 · 4 comments
Assignees
Milestone

Comments

@drmacro
Copy link
Member

drmacro commented Dec 17, 2015

Need to be able to run with OT 1.x or 2.x from same code distribution.

@drmacro
Copy link
Member Author

drmacro commented Dec 17, 2015

Using this issue to fix some cosmetic issues in the EPUB transform (incorrect informational messages, debug handling, etc.).

@drmacro
Copy link
Member Author

drmacro commented May 16, 2016

Partial support for OT 2.x implemented as of release 1.0.0RC18. However, full testing not yet done. XSLT uses now-deprecated templates for getting strings.

@raducoravu
Copy link
Contributor

The generated EPUBs using DITA OT 2.x are invalid according to EPUB Checker because they contain HTML 5 elements like article, main and also attributes like "aria-labelledby" which do not point to a specific target.
Problem seems to be the fact that in the XSLT stylesheet:

 DITA-OT2.x\plugins\org.dita.xhtml\xsl\dita2xhtml-util.xsl

there is a template:

  <xsl:template match="/">
    <xsl:variable name="content" as="node()*">
      <xsl:apply-imports/>
    </xsl:variable>
    <xsl:apply-templates select="$content" mode="add-xhtml-ns"/>
  </xsl:template>

which no longer gets called for your output, template which removes various HTML 5 elements and attributes.
As a possible workaround in the XSLT stylesheet:

 DITA-OT2.x\plugins\org.dita4publishers.epub\xsl\html2xhtmlImpl.xsl

you could add your own equivalent filtering:

      <xsl:template match="nav | section | figure | article" mode="html2xhtml" priority="20">
        <div>
          <xsl:apply-templates select="@* except (@role, @aria-labelledby) | node()" mode="html2xhtml"/>
        </div>
      </xsl:template>

      <!-- Group for root document node does not need extra XHTML div -->
      <xsl:template match="main/article" mode="html2xhtml" priority="30">
        <xsl:apply-templates select="node()" mode="html2xhtml"/>
      </xsl:template>

      <xsl:template match="header | footer | main" mode="html2xhtml" priority="20">
        <xsl:apply-templates select="node()" mode="html2xhtml"/>
      </xsl:template>

      <xsl:template match="div/@role" mode="html2xhtml" priority="10"/>

@raducoravu
Copy link
Contributor

Also the @scale attribute is not supported on images. There is a new DITA OT 2.x ANT target called "xhtml.image-metadata" which enriches the image elements in the DITA temporary topics with special attributes which list the original width and height detected from the image and it should get called before the main XSLT part of the EPUB plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants