<w:pStyle>
<xsl:attribute name='w:val'>
<xsl:choose>
+ <xsl:when test='(parent::section or
+ parent::sectioninfo/parent::section) and
+ count(ancestor::section) > 5'>
+ <xsl:message>section nested deeper than 5 levels</xsl:message>
+ <xsl:text>sect5-</xsl:text>
+ <xsl:value-of select='name()'/>
+ </xsl:when>
<xsl:when test='parent::section or
parent::sectioninfo/parent::section'>
<xsl:text>sect</xsl:text>
<xsl:template match='para'>
<xsl:param name='class'/>
- <xsl:variable name='block' select='blockquote|calloutlist|classsynopsis|funcsynopsis|figure|glosslist|graphic|informalfigure|informaltable|itemizedlist|literallayout|mediaobject|note|orderedlist|programlisting|revhistory|segmentedlist|simplelist|table|variablelist'/>
+ <xsl:variable name='block' select='blockquote|calloutlist|classsynopsis|funcsynopsis|figure|glosslist|graphic|informalfigure|informaltable|itemizedlist|literallayout|mediaobject|note|caution|warning|important|tip|orderedlist|programlisting|revhistory|segmentedlist|simplelist|table|variablelist'/>
<xsl:choose>
<xsl:when test='$block'>
</xsl:attribute>
</w:pStyle>
</w:pPr>
- <xsl:apply-templates select='following-sibling::node()[generate-id(preceding-sibling::*[self::blockquote|self::calloutlist|self::figure|self::glosslist|self::graphic|self::informalfigure|self::informaltable|self::itemizedlist|self::literallayout|self::mediaobject|self::note|self::orderedlist|self::programlisting|self::revhistory|self::segmentedlist|self::simplelist|self::table|self::variablelist][1]) = generate-id(current())]'/>
+ <xsl:apply-templates select='following-sibling::node()[generate-id(preceding-sibling::*[self::blockquote|self::calloutlist|self::figure|self::glosslist|self::graphic|self::informalfigure|self::informaltable|self::itemizedlist|self::literallayout|self::mediaobject|self::note|self::caution|self::warning|self::important|self::tip|self::orderedlist|self::programlisting|self::revhistory|self::segmentedlist|self::simplelist|self::table|self::variablelist][1]) = generate-id(current())]'/>
</w:p>
</xsl:for-each>
</xsl:when>
</w:r>
</xsl:template>
- <xsl:template match='text()[not(parent::para|parent::simpara)][string-length(normalize-space(.)) != 0]'>
+ <xsl:template match='text()[not(parent::para|parent::simpara|parent::literallayout)][string-length(normalize-space(.)) != 0]'>
<w:r>
<w:t>
<xsl:value-of select='.'/>
</w:r>
</xsl:template>
<xsl:template match='text()[string-length(normalize-space(.)) = 0]'/>
+ <xsl:template match='literallayout/text()'>
+ <xsl:call-template name='handle-linebreaks'/>
+ </xsl:template>
+ <xsl:template name='handle-linebreaks'>
+ <xsl:param name='text' select='.'/>
+
+ <xsl:choose>
+ <xsl:when test='not($text)'/>
+ <xsl:when test='contains($text, "
")'>
+ <w:r>
+ <w:t>
+ <xsl:value-of select='substring-before($text, "
")'/>
+ </w:t>
+ </w:r>
+ <xsl:call-template name='handle-linebreaks-aux'>
+ <xsl:with-param name='text'
+ select='substring-after($text, "
")'/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:r>
+ <w:t>
+ <xsl:value-of select='$text'/>
+ </w:t>
+ </w:r>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- pre-condition: leading linefeed has been stripped -->
+ <xsl:template name='handle-linebreaks-aux'>
+ <xsl:param name='text'/>
+
+ <xsl:choose>
+ <xsl:when test='contains($text, "
")'>
+ <w:r>
+ <w:br/>
+ <w:t>
+ <xsl:value-of select='substring-before($text, "
")'/>
+ </w:t>
+ </w:r>
+ <xsl:call-template name='handle-linebreaks-aux'>
+ <xsl:with-param name='text' select='substring-after($text, "
")'/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:r>
+ <w:br/>
+ <w:t>
+ <xsl:value-of select='$text'/>
+ </w:t>
+ </w:r>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
- <xsl:template match='authorblurb|formalpara|legalnotice|note'>
+ <xsl:template match='authorblurb|formalpara|legalnotice|note|caution|warning|important|tip'>
<xsl:apply-templates select='*'>
<xsl:with-param name='class'>
<xsl:value-of select='name()'/>
</xsl:if>
</xsl:template>
+ <xsl:template match='literallayout'>
+ <xsl:param name='class'/>
+
+ <w:p>
+ <w:pPr>
+ <w:pStyle w:val='literallayout'/>
+ </w:pPr>
+
+ <xsl:apply-templates/>
+ </w:p>
+ </xsl:template>
+
<xsl:template match='itemizedlist|orderedlist'>
<xsl:apply-templates select='listitem'/>
</xsl:template>
self::bridgehead |
self::calloutlist |
self::caption |
- self::caution |
self::chapter |
self::classsynopsis |
self::colophon |
self::highlights |
self::imageobject |
self::imageobjectco |
- self::important |
self::index |
self::indexdiv |
self::indexentry |
self::substeps |
self::task |
self::textobject |
- self::tip |
self::toc |
self::variablelist |
self::varlistentry |
self::videodata |
self::videoobject |
- self::warning |
self::*[not(starts-with(name(), "informal")) and contains(name(), "info")]'>
<w:p>
<w:pPr>
</itemizedlist>
<para>Attributes are a feature of DocBook XML that have no direct counterpart in Word. One approach is to use Word Bookmarks for attributes. For example, a Word Bookmark named <literal>att_role_foobar</literal> could be inserted into a paragraph. When converted to DocBook XML, this would become a <sgmltag class="attribute">role="foobar"</sgmltag> attribute on the element derived from the paragraph containing the Bookmark.</para>
<para>[Alternatively, we could use hidden text for attributes.]</para>
+<para>[Do we need a parameter to specify whether titles should be placed in the *info subelement?]</para>
<table>
<title>DocBook to WordML styles</title>
<tgroup cols="3"><colspec colnum="1" colname="col1"
<entry namest="col1" nameend="col3"><emphasis role="bold">Components and sections</emphasis></entry>
</row>
<row>
-<entry colname="col1">book</entry>
+<entry colname="col1">book/bookinfo/title</entry>
<entry colname="col2">book-title</entry>
<entry colname="col3"></entry>
</row>
<row>
-<entry colname="col1">chapter</entry>
+<entry colname="col1">book/bookinfo/subtitle</entry>
+<entry colname="col2">book-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">book/bookinfo/titleabbrev</entry>
+<entry colname="col2">book-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">chapter/chapterinfo/title</entry>
<entry colname="col2">chapter-title</entry>
<entry colname="col3">Assigned Word outline level 1.</entry>
</row>
<row>
-<entry colname="col1">appendix</entry>
+<entry colname="col1">chapter/chapterinfo/subtitle</entry>
+<entry colname="col2">chapter-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">chapter/chapterinfo/titleabbrev</entry>
+<entry colname="col2">chapter-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">appendix/appendixinfo/title</entry>
<entry colname="col2">appendix-title</entry>
<entry colname="col3">Assigned Word outline level 1.</entry>
</row>
<row>
-<entry colname="col1">preface</entry>
+<entry colname="col1">preface/prefaceinfo/title</entry>
<entry colname="col2">preface-title</entry>
<entry colname="col3">Assigned Word outline level 1.</entry>
</row>
<row>
-<entry colname="col1">article</entry>
+<entry colname="col1">article/articleinfo/title</entry>
<entry colname="col2">article-title</entry>
<entry colname="col3">Assigned Word outline level 1.</entry>
</row>
<row>
-<entry colname="col1">bibliography</entry>
+<entry colname="col1">article/articleinfo/subtitle</entry>
+<entry colname="col2">article-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">article/articleinfo/titleabbrev</entry>
+<entry colname="col2">article-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">bibliography/bibliographyinfo/title</entry>
<entry colname="col2">bibliography-title</entry>
<entry colname="col3">Assigned Word outline level 1.</entry>
</row>
<row>
-<entry colname="col1">glossary</entry>
+<entry colname="col1">glossary/glossaryinfo/title</entry>
<entry colname="col2">glossary-title</entry>
<entry colname="col3">Assigned Word outline level 1.</entry>
</row>
<row>
-<entry colname="col1">index</entry>
+<entry colname="col1">index/indexinfo/title</entry>
<entry colname="col2">index-title</entry>
<entry colname="col3">Assigned Word outline level 1.</entry>
</row>
<row>
-<entry colname="col1">sect1</entry>
+<entry colname="col1">sect1/sect1info/title</entry>
<entry colname="col2">sect1-title</entry>
<entry colname="col3">Assigned Word outline level 2.</entry>
</row>
<row>
-<entry colname="col1">sect2</entry>
+<entry colname="col1">sect1/sect1info/subtitle</entry>
+<entry colname="col2">sect1-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect1/sect1info/titleabbrev</entry>
+<entry colname="col2">sect1-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect2/sect2info/title</entry>
<entry colname="col2">sect2-title</entry>
<entry colname="col3">Assigned Word outline level 3.</entry>
</row>
<row>
-<entry colname="col1">sect3</entry>
+<entry colname="col1">sect2/sect2info/subtitle</entry>
+<entry colname="col2">sect2-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect2/sect2info/titleabbrev</entry>
+<entry colname="col2">sect2-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect3/sect3info/title</entry>
<entry colname="col2">sect3-title</entry>
<entry colname="col3">Assigned Word outline level 4.</entry>
</row>
<row>
-<entry colname="col1">sect4</entry>
+<entry colname="col1">sect3/sect3info/subtitle</entry>
+<entry colname="col2">sect3-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect3/sect3info/titleabbrev</entry>
+<entry colname="col2">sect3-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect4/sect4info/title</entry>
<entry colname="col2">sect4-title</entry>
<entry colname="col3">Assigned Word outline level 5.</entry>
</row>
<row>
-<entry colname="col1">sect5</entry>
+<entry colname="col1">sect4/sect4info/subtitle</entry>
+<entry colname="col2">sect4-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect4/sect4info/titleabbrev</entry>
+<entry colname="col2">sect4-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect5/sect5info/title</entry>
<entry colname="col2">sect5-title</entry>
<entry colname="col3">Assigned Word outline level 6.</entry>
</row>
<row>
+<entry colname="col1">sect5/sect5info/subtitle</entry>
+<entry colname="col2">sect5-subtitle</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">sect5/sect5info/titleabbrev</entry>
+<entry colname="col2">sect5-titleabbrev</entry>
+<entry colname="col3"></entry>
+</row>
+<row>
+<entry colname="col1">section</entry>
+<entry colname="col2">sectN-title</entry>
+<entry colname="col3">Unnumbered sections are mapped to their numbered equivalent. A parameter (named?) may be set to map numbered sections (<literal>sect1</literal>, etc) back to unnumbered sections.</entry>
+</row>
+<row>
<entry namest="col1" nameend="col3"><emphasis role="bold">Block-level elements</emphasis></entry>
</row>
<row>