]> granicus.if.org Git - docbook-dsssl/commitdiff
Added support for <?dbhtml stop-chunking?> processing instruction
authorDavid Cramer <david@thingbag.net>
Mon, 14 Jan 2008 16:57:11 +0000 (16:57 +0000)
committerDavid Cramer <david@thingbag.net>
Mon, 14 Jan 2008 16:57:11 +0000 (16:57 +0000)
xsl/html/chunk-common.xsl
xsl/html/pi.xsl

index a89c382e5c6ad692913c6423cb2dc790e3fccac7..fa53207d7a31b8818126c6283e598e14fefc78a8 100644 (file)
        http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
 
   <xsl:variable name="prev-v1"
-     select="(ancestor::sect1[$chunk.section.depth &gt; 0
+     select="(ancestor::sect1[$chunk.section.depth &gt; 0 
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect1][1]
 
              |ancestor::sect2[$chunk.section.depth &gt; 1
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect2
                                and parent::sect1[preceding-sibling::sect1]][1]
 
              |ancestor::sect3[$chunk.section.depth &gt; 2
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect3
                                and parent::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |ancestor::sect4[$chunk.section.depth &gt; 3
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect4
                                and parent::sect3[preceding-sibling::sect3]
                                and ancestor::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |ancestor::sect5[$chunk.section.depth &gt; 4
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect5
                                and parent::sect4[preceding-sibling::sect4]
                                and ancestor::sect3[preceding-sibling::sect3]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |ancestor::section[$chunk.section.depth &gt; count(ancestor::section)
+                                   and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                 and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
 
   <xsl:variable name="prev-v2"
      select="(preceding::sect1[$chunk.section.depth &gt; 0
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect1][1]
 
              |preceding::sect2[$chunk.section.depth &gt; 1
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect2
                                and parent::sect1[preceding-sibling::sect1]][1]
 
              |preceding::sect3[$chunk.section.depth &gt; 2
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect3
                                and parent::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |preceding::sect4[$chunk.section.depth &gt; 3
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect4
                                and parent::sect3[preceding-sibling::sect3]
                                and ancestor::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |preceding::sect5[$chunk.section.depth &gt; 4
+                               and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect5
                                and parent::sect4[preceding-sibling::sect4]
                                and ancestor::sect3[preceding-sibling::sect3]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |preceding::section[$chunk.section.depth &gt; count(ancestor::section)
+                                    and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                  and preceding-sibling::section
                                  and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
 
 
   <xsl:variable name="next-v1"
     select="(following::sect1[$chunk.section.depth &gt; 0
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect1][1]
 
              |following::sect2[$chunk.section.depth &gt; 1
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect2
                                and parent::sect1[preceding-sibling::sect1]][1]
 
              |following::sect3[$chunk.section.depth &gt; 2
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect3
                                and parent::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |following::sect4[$chunk.section.depth &gt; 3
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect4
                                and parent::sect3[preceding-sibling::sect3]
                                and ancestor::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |following::sect5[$chunk.section.depth &gt; 4
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect5
                                and parent::sect4[preceding-sibling::sect4]
                                and ancestor::sect3[preceding-sibling::sect3]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |following::section[$chunk.section.depth &gt; count(ancestor::section)
-                                 and preceding-sibling::section
+                                    and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
+                                 and preceding-sibling::section 
                                  and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
 
   <xsl:variable name="next-v2"
     select="(descendant::sect1[$chunk.section.depth &gt; 0
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect1][1]
 
              |descendant::sect2[$chunk.section.depth &gt; 1
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect2
                                and parent::sect1[preceding-sibling::sect1]][1]
 
              |descendant::sect3[$chunk.section.depth &gt; 2
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect3
                                and parent::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |descendant::sect4[$chunk.section.depth &gt; 3
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect4
                                and parent::sect3[preceding-sibling::sect3]
                                and ancestor::sect2[preceding-sibling::sect2]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |descendant::sect5[$chunk.section.depth &gt; 4
+                                  and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                and preceding-sibling::sect5
                                and parent::sect4[preceding-sibling::sect4]
                                and ancestor::sect3[preceding-sibling::sect3]
                                and ancestor::sect1[preceding-sibling::sect1]][1]
 
              |descendant::section[$chunk.section.depth &gt; count(ancestor::section)
+                                    and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])
                                  and preceding-sibling::section
                                  and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
 
   </xsl:param>
 
   <xsl:variable name="prev-v1"
-    select="(preceding::sect1[$chunk.section.depth &gt; 0][1]
-             |preceding::sect2[$chunk.section.depth &gt; 1][1]
-             |preceding::sect3[$chunk.section.depth &gt; 2][1]
-             |preceding::sect4[$chunk.section.depth &gt; 3][1]
-             |preceding::sect5[$chunk.section.depth &gt; 4][1]
-             |preceding::section[$chunk.section.depth &gt; count(ancestor::section)][1])[last()]"/>
+    select="(preceding::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |preceding::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |preceding::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |preceding::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |preceding::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |preceding::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
 
   <xsl:variable name="prev-v2"
-    select="(ancestor::sect1[$chunk.section.depth &gt; 0][1]
-             |ancestor::sect2[$chunk.section.depth &gt; 1][1]
-             |ancestor::sect3[$chunk.section.depth &gt; 2][1]
-             |ancestor::sect4[$chunk.section.depth &gt; 3][1]
-             |ancestor::sect5[$chunk.section.depth &gt; 4][1]
-             |ancestor::section[$chunk.section.depth &gt; count(ancestor::section)][1])[last()]"/>
+    select="(ancestor::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |ancestor::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |ancestor::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |ancestor::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |ancestor::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |ancestor::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[last()]"/>
 
   <xsl:variable name="prev"
     select="(preceding::book[1]
              |$prev-v2)[last()]"/>
 
   <xsl:variable name="next-v1"
-    select="(following::sect1[$chunk.section.depth &gt; 0][1]
-             |following::sect2[$chunk.section.depth &gt; 1][1]
-             |following::sect3[$chunk.section.depth &gt; 2][1]
-             |following::sect4[$chunk.section.depth &gt; 3][1]
-             |following::sect5[$chunk.section.depth &gt; 4][1]
-             |following::section[$chunk.section.depth &gt; count(ancestor::section)][1])[1]"/>
+    select="(following::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |following::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |following::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |following::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |following::sect5[$chunk.section.depth &gt; 4 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |following::section[$chunk.section.depth &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
 
   <xsl:variable name="next-v2"
-    select="(descendant::sect1[$chunk.section.depth &gt; 0][1]
-             |descendant::sect2[$chunk.section.depth &gt; 1][1]
-             |descendant::sect3[$chunk.section.depth &gt; 2][1]
-             |descendant::sect4[$chunk.section.depth &gt; 3][1]
-             |descendant::sect5[$chunk.section.depth &gt; 4][1]
+    select="(descendant::sect1[$chunk.section.depth &gt; 0 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |descendant::sect2[$chunk.section.depth &gt; 1 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |descendant::sect3[$chunk.section.depth &gt; 2 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |descendant::sect4[$chunk.section.depth &gt; 3 and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
+             |descendant::sect5[$chunk.section.depth &gt; 4and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1]
              |descendant::section[$chunk.section.depth 
-                                  &gt; count(ancestor::section)][1])[1]"/>
+                                  &gt; count(ancestor::section) and not(ancestor::*/processing-instruction('dbhtml')[normalize-space(.) ='stop-chunking'])][1])[1]"/>
 
   <xsl:variable name="next"
     select="(following::book[1]
 -->
 
   <xsl:choose>
+         <xsl:when test="$node/parent::*/processing-instruction('dbhtml')[normalize-space(.) = 'stop-chunking']">0</xsl:when>
     <xsl:when test="not($node/parent::*)">1</xsl:when>
 
     <xsl:when test="local-name($node) = 'sect1'
index fdb2d51037f4e956ba8a02c58d276ff26f16899e..d368e5536a381d7716e3a91549bb4705bc502e75 100644 (file)
   </refsee>
 </doc:pi>
 
+  <!-- The code that handles the stop-chunking pi is in chunk-common.xsl -->
+  <doc:pi name="stop-chunking" xmlns="">
+       <refpurpose>Do not chunk any descendents of this element.</refpurpose>
+       <refdescription>
+    <para>When generating chunked html output, adding this as the child of an element that contains elements that would normally be generated on separate pages if generating chunked output causes chunking to stop at this point. No descendants of the current element will be split into new html pages:
+<programlisting><![CDATA[<section>
+<title>Configuring pencil</title>
+<?dbhtml stop-chunking?>
 
+...
+
+</section>]]></programlisting>
+</para>
+  </refdescription>
+  <refsynopsisdiv>
+    <synopsis><tag class="xmlpi">dbhtml stop-chunking</tag></synopsis>
+  </refsynopsisdiv>    
+  <refsee role="tcg">
+    <para><link role="tcg"
+        xlink:href="Chunking.html"
+        >Background color</link></para>
+  </refsee>
+  </doc:pi>
+  
 </xsl:stylesheet>