Giter Site home page Giter Site logo

d4p-word2dita's Introduction

d4p-word2dita

NOTE: This project was intended to be a new home for the Word2DITA process but I haven't actually gotten it done.

The actual project is still the D4P plugin here: https://github.com/dita4publishers/org.dita4publishers.word2dita

Master project for the D4P word2dita transformation framework. Includes documentation, samples, etc.

d4p-word2dita's People

Contributors

contrext avatar drmacro avatar

Stargazers

Kurt Leadley avatar  avatar Tsuyoshi Okawa avatar  avatar

Watchers

James Cloos avatar  avatar  avatar Tsuyoshi Okawa avatar Eleanor Tesoro avatar Kurt Leadley avatar

d4p-word2dita's Issues

Missing image tags in dita when the images are inside tables in the XML

Hello,
I've come across an issue with the word2dita tool pertaining to images that happen to be within tables. The w2d transform is not recognizing these images during the xsl transform, thus the image tags are not created in the dita output.

Here are some details on what I have discovered and tried:

  1. The images are not visibly in tables when viewing the docx file. They are styled as Anchorlines.

  2. When saving the file as XML, I can see that the images are nested within these nodes: pkg:package/pkg:part/pkg:xmlData/w:document/w:body/w:tbl/w:tblPr/w:tr/w:tc/w:p/w:r/w:drawing (first attached

  3. I removed the table nodes from one of the images, saved it as a docx and ran it through the w2d transform. The image that I removed the table tags from is captured (albeit in an ol), the other image that I did not alter is still missing in the empty table (second attached image).

  4. I started sifting through the xsl files and found that in wordml2simple.xsl you have a template for a:blip that appears to be assigning image tags to the dita when found in the xml. This is around line 1240.

  5. This a:blip template doesn’t appear to match within tables. I have tried applying the a:blip template within <xsl:template match="w:tbl"> and also have tried creating a new template a few ways such as: <xsl:template match="pkg:package/pkg:part/pkg:xmlData/w:document/w:body/w:tbl/w:tblPr/w:tr/w:tc/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip">

I haven’t figured out how to match or apply templates for these images within the tables. Any ideas on how I can fix this, if at all?

Any help would be greatly appreciated,
Thanks and Regards,
-Kurt

image001

image002

Error with word2DITA transform

I've run into the following error message:

 [xslt]  + [INFO] ====================================
 [xslt]  + [INFO] Doing general simpleWpDoc fixup....
 [xslt]  + [INFO] ====================================
 [xslt]  + [DEBUG] Fixed-up simple WP doc saved as file:/C:/ditawork/all_defaults/dita/simpleWpDocFixup.xml
 [xslt] C:\ditawork\DITA-OT1.8.5\plugins\org.dita4publishers.word2dita\xsl\wordml2simpleAddLevels.xsl:53: Fatal Error! Cannot switch to a final result destination while writing a temporary tree
 [xslt] Failed to process C:\ditawork\all_defaults\word\temp\temp20150603152420971\word2bookmap_test_01\word\document.xml

I hit this with a fresh install of the OT, with both 0.9.19 and 1.0 RC 9 of the d4p plugin. Tried on my own docx files and the sample.

Some other parts of the log:

initProperties:
[echo] +++ word2dita-specific properties:
[echo] #Ant properties
[echo] #Wed Jun 03 15:24:21 EDT 2015
[echo] w2d.base.dir=C:\ditawork\DITA-OT1.8.5\plugins\org.dita4publishers.word2dita
[echo] w2d.clean.output.dir=true
[echo] w2d.debug.xslt=true
[echo] w2d.defaultStyleToTagMap=C:\ditawork\DITA-OT1.8.5\plugins\org.dita4publishers.word2dita\xsl\word-builtin-styles-style2tagmap.xml
[echo] w2d.generate.navtitles=true
[echo] w2d.have.word.doc=true
[echo] w2d.language=en-US
[echo] w2d.out.dir=C:\ditawork\all_defaults\dita
[echo] w2d.root.map.name=word2bookmap_test_01
[echo] w2d.root.output.filename=word2bookmap_test_01.ditamap
[echo] w2d.style-to-tag-map=C:\ditawork\all_defaults\word\style2tagmap.xml
[echo] w2d.temp.dir=C:\ditawork\all_defaults\word\temp\temp20150603152420971
[echo] w2d.topic.extension=.dita
[echo] w2d.word2dita.xslt=C:\ditawork\DITA-OT1.8.5\plugins\org.dita4publishers.word2dita\xsl\docx2dita.xsl
[echo] w2p.do.clean.output.dir=true

...

transformWordToDita:
[echo] [INFO] Creating output directory C:\ditawork\all_defaults\dita...
[echo] [INFO] Creating output file word2bookmap_test_01.ditamap...
[echo] [INFO] Generating DITA documents from Word document in output directory C:\ditawork\all_defaults\dita...
[echo] [INFO] Using XSLT C:\ditawork\DITA-OT1.8.5\plugins\org.dita4publishers.word2dita\xsl\docx2dita.xsl...
[xslt] Processing C:\ditawork\all_defaults\word\temp\temp20150603152420971\word2bookmap_test_01\word\document.xml to C:\ditawork\all_defaults\dita\word2bookmap_test_01.ditamap
[xslt] Loading stylesheet C:\ditawork\DITA-OT1.8.5\plugins\org.dita4publishers.word2dita\xsl\docx2dita.xsl
[xslt]
[xslt] ==========================================
[xslt] DOCX 2 DITA
[xslt]
[xslt] Version: ^version^ - build ^buildnumber^ at ^timestamp^
[xslt]
[xslt] Parameters:
[xslt]
[xslt] + styleMapUri = "file:/C:/ditawork/all_defaults/word/style2tagmap.xml"
[xslt] + mediaDirUri = "file:/C:/ditawork/all_defaults/dita/topics/media"
[xslt] + rootMapName = "word2bookmap_test_01"
[xslt] + rootTopicName = ""
[xslt] + submapNamePrefix= "map"
[xslt] + rootMapUrl = "word2bookmap_test_01.ditamap"
[xslt] + rootTopicUrl = ""
[xslt] + topicExtension = ".dita"
[xslt] + fileNamePrefix = ""
[xslt] + filterBr = "false"
[xslt] + filterTabs = "false"
[xslt] + language = "en-US"
[xslt] + outputDir = "file:/C:/ditawork/all_defaults/dita/"
[xslt] + debug = "true"
[xslt] + includeWordBackPointers= "true"
[xslt] + chartsAsTables = "false"
[xslt] + saveIntermediateDocs = "false"
[xslt]
[xslt] Global Variables:
[xslt]
[xslt] + platform = "windows"
[xslt] + debugBoolean = "true"
[xslt] + doSaveIntermediateDocs = "true"

Thanks again!

Dropped Content When Following Footnote/Endnote

Have encountered a scenario where content is being dropped. The content that gets dropped is text content that follows a footnote/endnote. This happens when the WordML run <w:r> that contains the footnote/endnote is:

  1. Immediately preceded by a WordML element that is not a run (<w:r>)
  2. Immediately followed by one or more runs

For example:
<w:proofErr w:type="gramEnd"/>
<w:r w:rsidRPr="00593DB3">
<w:rPr>
<w:rStyle w:val="EndnoteReference"/>
</w:rPr>
<w:endnoteReference w:id="294"/>
</w:r>
<w:r w:rsidRPr="00593DB3">
<w:t xml:space="preserve"> Nothing it seemed was overlooked. It was impressive also because everything seemed to be covered in great detail but with a politeness and dignity </w:t>
</w:r>

The bug in the code is in the named template "handlePara" in wordml2simple.xsl:

 <xsl:for-each-group 
    select="*" 
    group-adjacent="name(.)">
    <xsl:choose>
      <xsl:when test="current-group()[1][self::w:r/w:endnoteReference]">
        <xsl:if test="false() and $debugBoolean">
          <xsl:message> + [DEBUG] handlePara: handling w:r/w:endnoteReference</xsl:message>
        </xsl:if>
        <xsl:call-template name="handleEndNoteRef">
            <xsl:with-param name="runSequence" select="current-group()"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="current-group()[1][self::w:r[w:footnoteReference]]">
        <xsl:if test="false() and $debugBoolean">
          <xsl:message> + [DEBUG] handlePara: handling w:r/w:footnoteReference</xsl:message>
        </xsl:if>
        <xsl:call-template name="handleFootNoteRef">
            <xsl:with-param name="runSequence" select="current-group()"/>
        </xsl:call-template>
      </xsl:when>
      <!-- truncated here -->

What happens is that when some element that is not a run immediately precedes the run that contains the footnote/endnote, the run containing the footnote/endnote becomes the first member of the group. Then either the first or second condition in the choose activates: the footnote/endnote content is processed but any following runs are not.

One simple fix is to simply remove the first two conditions here. The footnote/endnote will process as will subsequent runs.

Too many dependencies for "org.dita4publishers.word2dita" plugin?

Maybe remove dependencies to "org.dita4publishers.doctypes", "org.dita4publishers.math", "org.dita4publishers.xmldomain.doctypes"?
Also in the released package inside the "org.dita4publishers.word2dita" folder there is an extra "org.dita-community.common.xslt" folder although this folder also exists as a separate plugin on which the word2dita plugin depends.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.