Index: /trunk/doc/manual/Makefile.kmk
===================================================================
--- /trunk/doc/manual/Makefile.kmk	(revision 56481)
+++ /trunk/doc/manual/Makefile.kmk	(revision 56482)
@@ -755,4 +755,9 @@
 	               -e 's|\$$TARGETPATH|$(@D)|g' --output $@ $<
 
+ # Manual formatcfg dependencies.
+ $(foreach lang,$(VBOX_MANUAL_LANGUAGES), $(VBOX_PATH_MANUAL_OUTBASE)/$(lang)/docbook-htmlhelp-formatcfg.xsl): \
+ 	$(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
+ 	$(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
+
  # Prepare the XSL file for our title page, htmlhelp variant.
  $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/titlepage-htmlhelp.xsl): \
@@ -805,4 +810,10 @@
 #
 ##########################################################################################
+
+# Manual formatcfg dependencies.
+$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-one-page-formatcfg.xsl \
+$(VBOX_PATH_MANUAL_OUTBASE)/en_US/docbook-html-chunks-formatcfg.xsl: \
+	$(VBOX_PATH_MANUAL_SRC)/common-formatcfg.xsl \
+	$(VBOX_PATH_MANUAL_SRC)/common-html-formatcfg.xsl
 
 # intermediate step to do some variable replacement in the XSL configuration
Index: /trunk/doc/manual/common-formatcfg.xsl
===================================================================
--- /trunk/doc/manual/common-formatcfg.xsl	(revision 56481)
+++ /trunk/doc/manual/common-formatcfg.xsl	(revision 56482)
@@ -56,3 +56,65 @@
 </xsl:attribute-set>
 
+
+<!--
+  refentry related layout tweaks.
+
+  Note! While we could save us all this work by using refsect1..3 and
+        refsynopsisdiv docbook-refentry-to-manual-sect1.xsl, we'd like to have
+        a valid XML document and thus do do some extra markup using the role
+        and condition attributes.  We catch some of it here.  But the XSLT
+        for specific targets (html, latex, etc) have a few more tweaks
+        related to this.
+
+        The @role has only one special trick 'not-in-toc' that excludes sections
+        like 'Synopsis' and 'Description' from the TOCs.
+
+        The @condition records the original refentry element name, i.e. it will
+        have values like refentry, refsynopsisdiv, refsect1, refsect2 and refsect3.
+  -->
+
+<!-- This removes the not-in-toc bits from the toc. -->
+<xsl:template match="sect2[@role = 'not-in-toc']"      mode="toc" />
+<xsl:template match="sect3[@role = 'not-in-toc']"      mode="toc" />
+<xsl:template match="sect4[@role = 'not-in-toc']"      mode="toc" />
+<xsl:template match="sect5[@role = 'not-in-toc']"      mode="toc" />
+<xsl:template match="section[@role = 'not-in-toc']"    mode="toc" />
+<xsl:template match="simplesect[@role = 'not-in-toc']" mode="toc" />
+
+<!-- This removes unnecessary <dd><dl> stuff caused by the above. -->
+<xsl:template match="sect1[sect2/@role = 'not-in-toc']" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="sect2[@role != 'not-in-toc'] | bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="sect2[sect3/@role = 'not-in-toc']" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="sect3[@role != 'not-in-toc'] | bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- This make the refsect* and refsynopsisdiv unnumbered like the default refentry rendering. -->
+<xsl:template match="sect2[@condition = 'refsynopsisdiv']
+                   | sect2[starts-with(@condition, 'refsect')]
+                   | sect3[starts-with(@condition, 'refsect')]
+                   | sect4[starts-with(@condition, 'refsect')]
+                   | sect5[starts-with(@condition, 'refsect')]
+                   | section[starts-with(@condition, 'refsect')]
+                   | simplesect[starts-with(@condition, 'refsect')]"
+  mode="object.title.template"
+  >
+    <xsl:call-template name="gentext.template">
+      <xsl:with-param name="context" select="'title-unnumbered'"/>
+      <xsl:with-param name="name">
+        <xsl:call-template name="xpath.location"/>
+      </xsl:with-param>
+    </xsl:call-template>
+</xsl:template>
+
+
 </xsl:stylesheet>
Index: /trunk/doc/manual/docbook-refentry-to-manual-sect1.xsl
===================================================================
--- /trunk/doc/manual/docbook-refentry-to-manual-sect1.xsl	(revision 56481)
+++ /trunk/doc/manual/docbook-refentry-to-manual-sect1.xsl	(revision 56482)
@@ -51,10 +51,9 @@
 <!-- rename refentry to sect1 -->
 <xsl:template match="refentry">
-  <sect1>
+  <xsl:element name="sect1">
+    <xsl:attribute name="condition">refentry</xsl:attribute>
     <xsl:apply-templates select="node()|@*"/>
-  </sect1>
+  </xsl:element>
 </xsl:template>
-
-<!-- TODO: refsect1 -> sect2 or something... -->
 
 <!-- Remove refentryinfo, keeping the title element. -->
@@ -67,11 +66,58 @@
 <!-- Morph refnamediv into a brief description. -->
 <xsl:template match="refnamediv">
-  <para>
+  <xsl:element name="para">
     <xsl:call-template name="capitalize">
       <xsl:with-param name="text" select="normalize-space(./refpurpose)"/>
     </xsl:call-template>
     <xsl:text>.</xsl:text>
-  </para>
+  </xsl:element>
 </xsl:template>
+
+<!-- Morph the refsynopsisdiv part into a synopsis section. -->
+<xsl:template match="refsynopsisdiv">
+  <xsl:if test="name(*[1]) != 'cmdsynopsis'"><xsl:message terminate="yes">Expected refsynopsisdiv to start with cmdsynopsis</xsl:message></xsl:if>
+  <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
+
+  <xsl:element name="sect2">
+    <xsl:attribute name="role">not-in-toc</xsl:attribute>
+    <xsl:attribute name="condition">refsynopsisdiv</xsl:attribute>
+    <xsl:element name="title">
+    <xsl:text>Synopsis</xsl:text>
+    </xsl:element>
+    <xsl:apply-templates />
+  </xsl:element>
+
+</xsl:template>
+
+<!-- refsect1 -> sect2 -->
+<xsl:template match="refsect1">
+  <xsl:if test="not(title)"><xsl:message terminate="yes">refsect1 requires title</xsl:message></xsl:if>
+  <xsl:element name="sect2">
+    <xsl:attribute name="role">not-in-toc</xsl:attribute>
+    <xsl:attribute name="condition">refsect1</xsl:attribute>
+    <xsl:apply-templates />
+  </xsl:element>
+</xsl:template>
+
+<!-- refsect2 -> sect3 -->
+<xsl:template match="refsect2">
+  <xsl:if test="not(title)"><xsl:message terminate="yes">refsect2 requires title</xsl:message></xsl:if>
+  <xsl:element name="sect3">
+    <xsl:attribute name="role">not-in-toc</xsl:attribute>
+    <xsl:attribute name="condition">refsect2</xsl:attribute>
+    <xsl:apply-templates />
+  </xsl:element>
+</xsl:template>
+
+<!-- refsect3 -> sect4 -->
+<xsl:template match="refsect3">
+  <xsl:if test="not(title)"><xsl:message terminate="yes">refsect3 requires title</xsl:message></xsl:if>
+  <xsl:element name="sect4">
+    <xsl:attribute name="role">not-in-toc</xsl:attribute>
+    <xsl:attribute name="condition">refsect3</xsl:attribute>
+    <xsl:apply-templates />
+  </xsl:element>
+</xsl:template>
+
 
 <!-- Remove refmeta. -->
Index: /trunk/doc/manual/docbook2latex.xsl
===================================================================
--- /trunk/doc/manual/docbook2latex.xsl	(revision 56481)
+++ /trunk/doc/manual/docbook2latex.xsl	(revision 56482)
@@ -329,5 +329,5 @@
         </xsl:call-template>
       </xsl:when>
-      <xsl:when test="parent::sect2[@condition='no-toc'] or parent::refsect1 or (parent::section and count(ancestor::section) = 2)">
+      <xsl:when test="parent::sect2[@role='not-in-toc'] or parent::refsect1 or (parent::section and count(ancestor::section) = 2)">
         <xsl:call-template name="title-wrapper">
           <xsl:with-param name="texcmd">\subsection*</xsl:with-param>
@@ -339,5 +339,5 @@
         </xsl:call-template>
       </xsl:when>
-      <xsl:when test="parent::sect3[@condition='no-toc'] or parent::refsect2 or (parent::section and count(ancestor::section) = 3)">
+      <xsl:when test="parent::sect3[@role='not-in-toc'] or parent::refsect2 or (parent::section and count(ancestor::section) = 3)">
         <xsl:call-template name="title-wrapper">
           <xsl:with-param name="texcmd">\subsubsection*</xsl:with-param>
@@ -349,5 +349,5 @@
         </xsl:call-template>
       </xsl:when>
-      <xsl:when test="parent::sect4[@condition='no-toc'] or parent::refsect3 or (parent::section and count(ancestor::section) = 4)">
+      <xsl:when test="parent::sect4[@role='not-in-toc'] or parent::refsect3 or (parent::section and count(ancestor::section) = 4)">
         <xsl:call-template name="title-wrapper">
           <xsl:with-param name="texcmd">\paragraph*</xsl:with-param>
@@ -359,5 +359,5 @@
         </xsl:call-template>
       </xsl:when>
-      <xsl:when test="parent::sect5[@condition='no-toc'] or parent::refsect4 or (parent::section and count(ancestor::section) = 5)">
+      <xsl:when test="parent::sect5[@role='not-in-toc'] or parent::refsect4 or (parent::section and count(ancestor::section) = 5)">
         <xsl:call-template name="title-wrapper">
           <xsl:with-param name="texcmd">\subparagraph*</xsl:with-param>
