# Word formatting not retained; parser errors

**URL:** <https://pressbooks.community/t/word-formatting-not-retained-parser-errors/976>\
**Category:** Importing & Exporting Content\
**Created:** [June 4, 2019, 3:51pm UTC](https://pressbooks.community/t/word-formatting-not-retained-parser-errors/976 "2019-06-04T15:51:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlsmith](https://pressbooks.community/user_avatar/pressbooks.community/jlsmith/32/590_2.png) [@jlsmith](https://pressbooks.community/u/jlsmith)\
**Post date:** [June 4, 2019, 3:51pm UTC](https://pressbooks.community/t/word-formatting-not-retained-parser-errors/976/1 "2019-06-04T15:51:12Z")

</div>

2 issues. Possibly related.

When importing text from Word, select formatting is not carrying over and it includes `&nbsp;` in spaces. Lists, some bold, and some headings are coming but not others. For instance, I imported a chapter with H4s and H2s but only the H4s carried over. I do not have Paste As Text selected.

This also results in parser errors in my HTML book exports until I manually remove all the &nbsp: I also get the following error when exporting epubs: “SXWN9000: The parent axis starting at a document node will never select anything”.

See attached screenshots of logs.

 ![40%20AM](https://pressbooks.community/uploads/default/original/1X/0aeb353962c0a6286f7e5fab1e82afc52a7b6f69.png) ![30%20AM](https://pressbooks.community/uploads/default/original/1X/35f155c1c141b0b44969010e84f7606340513179.png) ![17%20AM](https://pressbooks.community/uploads/default/original/1X/e96c3b895f75c409e6a53651d725d5e7721bcce4.png)

Pressbooks 5.8.1  
McLuhan 2.8.1

---

<div class="post-metadata">

**Author:** ![dac.chartrand](https://pressbooks.community/user_avatar/pressbooks.community/dac.chartrand/32/152_2.png) [@dac.chartrand](https://pressbooks.community/u/dac.chartrand)\
**Post date:** [June 4, 2019, 11:50pm UTC](https://pressbooks.community/t/word-formatting-not-retained-parser-errors/976/2 "2019-06-04T23:50:00Z")

</div>

#1

Not all formatting in Word Documents is preserved.

> Everything other than basic styling is stripped out _by design_ … so fancy fonts and such won’t get imported. Italics, bold etc. should.

[https://guide.pressbooks.com/chapter/import-from-word-docx/](https://guide.pressbooks.com/chapter/import-from-word-docx/)

#2

HTMLBook was an attempt to migrate away from our own home grown XHTML format. We hopped it would allow us to use HMTL5 more loosely. Unfortunately, our assumption was wrong. HTMLBook is more strict than XHTML when it comes to nagging about XML problems. I wouldn’t worry about it. Unless you’re a developer and you absolutely need HTMLBook to do some experimental hacking… simply don’t use that format. It’s not for public consumption, yet.

[https://oreillymedia.github.io/HTMLBook/](https://oreillymedia.github.io/HTMLBook/)

#3

Known bug? Your version of java, or epubcheck, needs to be updated…

> <https://github.com/w3c/epubcheck/issues/859#issuecomment-437801722>
>
> Hello!
> 
> \* I am on MacOS (latest)
> \* I installed the Oracle JDK (latest v11.0.1… from https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html )
> \* I installed Maven (latest)
> 
> \* I cloned this repository and checkout'ed the \`master\` branch
> \* I invoked the Maven install command (no problems)
> \* I ran EpubCheck from the command line against a few EPUBs (seems to work just fine).
> \* However, the following message is reported over 20 times in the console (just before the actual validation message):
> 
> \`\`\`
> Warning at char 3 in xsl:param/@select on line 459 column 43 
> SXWN9000: The parent axis starting at a document node will never select anything
> \`\`\`
> 
> \`\`\`
> Validating using EPUB version 3.0.1 rules.
> No errors or warnings detected.
> Messages: 0 fatal / 0 errors / 0 warnings / 0 info
> \`\`\`
> 
> System:
> 
> \`java --version\`
> \`\`\`
> java 11 2018-09-25
> Java(TM) SE Runtime Environment 18.9 (build 11+28)
> Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
> \`\`\`
> 
> \`mvn --version\`
> \`\`\`
> Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T19:33:14+01:00)
> Maven home: /Applications/apache-maven
> Java version: 11, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
> Default locale: en\_GB, platform encoding: UTF-8
> OS name: "mac os x", version: "10.14", arch: "x86\_64", family: "mac"
> \`\`\`
> 
> \`java -jar target/epubcheck.jar --version\`
> \`\`\`
> EpubCheck v4.0.3-SNAPSHOT
> No file specified in the arguments. Exiting.
> epubcheck completed
> \`\`\`

Regards,

---

<div class="post-metadata">

**Author:** ![jlsmith](https://pressbooks.community/user_avatar/pressbooks.community/jlsmith/32/590_2.png) [@jlsmith](https://pressbooks.community/u/jlsmith)\
**Post date:** [June 18, 2019, 7:55pm UTC](https://pressbooks.community/t/word-formatting-not-retained-parser-errors/976/3 "2019-06-18T19:55:56Z")

</div>

Thanks @dac.chartrand.

#1 I had forgotten about the import from Word option. I will do this from now on with Word files. I also was having issues with spacing and found this chapter of the PB userguide that helped: [[https://guide.pressbooks.com/chapter/section-breaks-page-breaks-and-blank-pages/](https://guide.pressbooks.com/chapter/section-breaks-page-breaks-and-blank-pages/)]

#2 No problem. I don’t have an exact use case for HTML Book, it was just annoying me that it wasn’t working, but I won’t worry about it.

#3 In response to your suggestion that our version of java, epubcheck needs to be updated, my systems guy says:

> Messages like this come from the formatting of the document, the parent axis comes from the above message, Error while parsing file 'attribute “value” not allowed here; expected attribute “class”, “dir”, “id”, “lang”, “style”, “title” or “xml:lang” . This comes from the formatting of the document, in this specific message from having a numbered list, with text in it outside of the numbered list - then resuming the list. As that is not supported by EPUB. [https://publishdrive.zendesk.com/hc/en-us/articles/115004351854-Error-while-parsing-file-attribute-value-not-allowed-here-expected-attribute-class-dir-id-lang-style-title-or-xml-lang-](https://publishdrive.zendesk.com/hc/en-us/articles/115004351854-Error-while-parsing-file-attribute-value-not-allowed-here-expected-attribute-class-dir-id-lang-style-title-or-xml-lang-). Other errors are also coming from badly formatted documents. We cannot install older versions of software that may leave us open to issues. The messages are not being made directly from pressbooks, but from a epub xslt. As the epub format does not support some types of text formatting.

So I suspect this may be resolved by following the procedures in #1?
