]> granicus.if.org Git - docbook-dsssl/commitdiff
Processing of listitems now processes and preserves order of comments and PIs.
authorBob Stayton <bobs@sagehill.net>
Mon, 1 Dec 2003 23:25:05 +0000 (23:25 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 1 Dec 2003 23:25:05 +0000 (23:25 +0000)
xsl/html/lists.xsl

index 27743a9c95861b19c2b5e8aac84d81c2e9235e88..210a2b7193638343009bf7ae7c209365a657beeb 100644 (file)
       <xsl:call-template name="formal.object.heading"/>
     </xsl:if>
 
-    <xsl:apply-templates select="*[not(self::listitem
-                                   or self::title
-                                   or self::titleabbrev)]"/>
+    <!-- Preserve order of PIs and comments -->
+    <xsl:apply-templates 
+        select="*[not(self::listitem
+                  or self::title
+                  or self::titleabbrev)]
+                |comment()[not(preceding-sibling::listitem)]
+                |processing-instruction()[not(preceding-sibling::listitem)]"/>
 
     <ul>
       <xsl:if test="$css.decoration != 0">
           <xsl:value-of select="@spacing"/>
         </xsl:attribute>
       </xsl:if>
-      <xsl:apply-templates select="listitem"/>
+      <xsl:apply-templates 
+            select="listitem
+                    |comment()[preceding-sibling::listitem]
+                    |processing-instruction()[preceding-sibling::listitem]"/>
     </ul>
   </div>
 </xsl:template>
   <xsl:variable name="usemark">
     <xsl:choose>
       <xsl:when test="$override != ''">
-       <xsl:value-of select="$override"/>
+        <xsl:value-of select="$override"/>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:value-of select="$mark"/>
+        <xsl:value-of select="$mark"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
@@ -67,7 +74,7 @@
       <xsl:when test="$usemark = 'bullet'">disc</xsl:when>
       <xsl:when test="$usemark = 'box'">square</xsl:when>
       <xsl:otherwise>
-       <xsl:value-of select="$usemark"/>
+        <xsl:value-of select="$usemark"/>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
@@ -75,8 +82,8 @@
   <li>
     <xsl:if test="$css.decoration = '1' and $cssmark != ''">
       <xsl:attribute name="style">
-       <xsl:text>list-style-type: </xsl:text>
-       <xsl:value-of select="$cssmark"/>
+        <xsl:text>list-style-type: </xsl:text>
+        <xsl:value-of select="$cssmark"/>
       </xsl:attribute>
     </xsl:if>
 
 
     <xsl:choose>
       <xsl:when test="$show.revisionflag != 0 and @revisionflag">
-       <div class="{@revisionflag}">
-         <xsl:apply-templates/>
-       </div>
+        <div class="{@revisionflag}">
+          <xsl:apply-templates/>
+        </div>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:apply-templates/>
+        <xsl:apply-templates/>
       </xsl:otherwise>
     </xsl:choose>
   </li>
       <xsl:call-template name="formal.object.heading"/>
     </xsl:if>
 
-    <xsl:apply-templates select="*[not(self::listitem
-                                   or self::title
-                                   or self::titleabbrev)]"/>
+    <!-- Preserve order of PIs and comments -->
+    <xsl:apply-templates 
+        select="*[not(self::listitem
+                  or self::title
+                  or self::titleabbrev)]
+                |comment()[not(preceding-sibling::listitem)]
+                |processing-instruction()[not(preceding-sibling::listitem)]"/>
 
     <ol>
       <xsl:if test="$start != '1'">
           <xsl:value-of select="@spacing"/>
         </xsl:attribute>
       </xsl:if>
-      <xsl:apply-templates select="listitem"/>
+      <xsl:apply-templates 
+            select="listitem
+                    |comment()[preceding-sibling::listitem]
+                    |processing-instruction()[preceding-sibling::listitem]"/>
     </ol>
   </div>
 </xsl:template>
 
     <xsl:choose>
       <xsl:when test="$show.revisionflag != 0 and @revisionflag">
-       <div class="{@revisionflag}">
-         <xsl:apply-templates/>
-       </div>
+        <div class="{@revisionflag}">
+          <xsl:apply-templates/>
+        </div>
       </xsl:when>
       <xsl:otherwise>
-       <xsl:apply-templates/>
+        <xsl:apply-templates/>
       </xsl:otherwise>
     </xsl:choose>
   </li>
 
     <xsl:choose>
       <xsl:when test="$presentation = 'table'">
-        <xsl:apply-templates select="*[not(self::varlistentry
-                                           or self::title
-                                           or self::titleabbrev)]"/>
+        <!-- Preserve order of PIs and comments -->
+        <xsl:apply-templates 
+          select="*[not(self::varlistentry
+                    or self::title
+                    or self::titleabbrev)]
+                  |comment()[not(preceding-sibling::varlistentry)]
+                  |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
         <table border="0">
           <xsl:if test="$list-width != ''">
             <xsl:attribute name="width">
             </xsl:if>
           </col>
           <tbody>
-            <xsl:apply-templates select="varlistentry" mode="varlist-table"/>
+            <xsl:apply-templates mode="varlist-table"
+              select="varlistentry
+                      |comment()[preceding-sibling::varlistentry]
+                      |processing-instruction()[preceding-sibling::varlistentry]"/>
           </tbody>
         </table>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="*[not(self::varlistentry
-                                           or self::title
-                                           or self::titleabbrev)]"/>
+        <!-- Preserve order of PIs and comments -->
+        <xsl:apply-templates 
+          select="*[not(self::varlistentry
+                    or self::title
+                    or self::titleabbrev)]
+                  |comment()[not(preceding-sibling::varlistentry)]
+                  |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
         <dl>
-          <xsl:apply-templates select="varlistentry"/>
+          <xsl:apply-templates 
+              select="varlistentry
+                      |comment()[preceding-sibling::varlistentry]
+                      |processing-instruction()[preceding-sibling::varlistentry]"/>
         </dl>
       </xsl:otherwise>
     </xsl:choose>
   <xsl:choose>
     <xsl:when test="$show.revisionflag != 0 and @revisionflag">
       <div class="{@revisionflag}">
-       <xsl:apply-templates/>
+        <xsl:apply-templates/>
       </div>
     </xsl:when>
     <xsl:otherwise>
   <table class="simplelist" border="0" summary="Simple list">
     <xsl:call-template name="simplelist.vert">
       <xsl:with-param name="cols">
-       <xsl:choose>
-         <xsl:when test="@columns">
-           <xsl:value-of select="@columns"/>
-         </xsl:when>
-         <xsl:otherwise>1</xsl:otherwise>
-       </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="@columns">
+            <xsl:value-of select="@columns"/>
+          </xsl:when>
+          <xsl:otherwise>1</xsl:otherwise>
+        </xsl:choose>
       </xsl:with-param>
     </xsl:call-template>
   </table>
       </xsl:call-template>
 
       <xsl:call-template name="simplelist.vert.row">
-       <xsl:with-param name="cols" select="$cols"/>
-       <xsl:with-param name="rows" select="$rows"/>
-       <xsl:with-param name="cell" select="$cell"/>
-       <xsl:with-param name="members" select="$members"/>
+        <xsl:with-param name="cols" select="$cols"/>
+        <xsl:with-param name="rows" select="$rows"/>
+        <xsl:with-param name="cell" select="$cell"/>
+        <xsl:with-param name="members" select="$members"/>
       </xsl:call-template>
     </tr>
     <xsl:call-template name="simplelist.vert">
     </xsl:choose>
   </xsl:variable>
 
+  <!-- Preserve order of PIs and comments -->
   <xsl:variable name="preamble"
-                select="*[not(self::step
-                              or self::title
-                              or self::titleabbrev)]"/>
+        select="*[not(self::step
+                  or self::title
+                  or self::titleabbrev)]
+                |comment()[not(preceding-sibling::step)]
+                |processing-instruction()[not(preceding-sibling::step)]"/>
 
   <div class="{name(.)}">
     <xsl:call-template name="anchor"/>
     <xsl:choose>
       <xsl:when test="count(step) = 1">
         <ul>
-          <xsl:apply-templates select="step"/>
+          <xsl:apply-templates 
+            select="step
+                    |comment()[preceding-sibling::step]
+                    |processing-instruction()[preceding-sibling::step]"/>
         </ul>
       </xsl:when>
       <xsl:otherwise>
           <xsl:attribute name="type">
             <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
           </xsl:attribute>
-          <xsl:apply-templates select="step"/>
+          <xsl:apply-templates 
+            select="step
+                    |comment()[preceding-sibling::step]
+                    |processing-instruction()[preceding-sibling::step]"/>
         </ol>
       </xsl:otherwise>
     </xsl:choose>