Mats B. wrote:

I found your Word to XML (DocBook) converter, which I think could be
very useful for some tech writing scenarios here at XXX.

However, I noticed that it outputs (visually) unstructured DocBook XML,
in one long, single line.

Note that it creates well-formed, *valid* DocBook. When this is not the case, please report this as a bug.




Is there any option one can set to output a visually structured,
tree-like, XML file?

No there is no such option. However, if you edit:

<w2x_install_dir>/xslt/docbook.xslt

(DocBook 4; no namespace)

OR

<w2x_install_dir>/xslt/docbook5.xslt

(DocBook 5; "http://docbook.org/ns/docbook";)

and change:

---
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
---

to:

---
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
---

you'll obtain a indented DocBook file.



However be warned that such indented DocBook files are only useful when debugging.

The XSLT processor, Saxon to name it, which creates the indented DocBook files has no idea of the DocBook grammar and will add indentation whitespace to all elements, even elements where whitespace is significant.

On the other hand, if you use an XML pretty-printer which knows about the DocBook grammar, you'll get both nice, readable DocBook files and correct DocBook files, where indentation has been added only to places where it is not significant.



The xmltool command-line utility which is part of XMLmind XML Editor distributions is such pretty printer. Example:

---
xmltool indent -indent 2 raw.xml indented.xml
---

* XMLmind XML Editor Evaluation Edition:
http://www.xmlmind.com/xmleditor/download.shtml

* The xmltool command-line utility
http://www.xmlmind.com/xmleditor/_distrib/doc/xmltool/index.html

--
XMLmind Word To XML Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/w2x-support

Reply via email to