]> granicus.if.org Git - docbook-dsssl/commitdiff
A chunking stylesheet that makes a single chunk, so that output properties can be...
authorNorman Walsh <ndw@nwalsh.com>
Sun, 9 Sep 2001 16:28:16 +0000 (16:28 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 9 Sep 2001 16:28:16 +0000 (16:28 +0000)
xsl/html/onechunk.xsl [new file with mode: 0644]

diff --git a/xsl/html/onechunk.xsl b/xsl/html/onechunk.xsl
new file mode 100644 (file)
index 0000000..50ae1a1
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
+                version="1.0"
+                exclude-result-prefixes="doc">
+
+<!-- This stylesheet works with Saxon and Xalan; for XT use xtchunk.xsl -->
+<!-- This stylesheet should also work for any processor that supports   -->
+<!-- exslt:document() (see http://www.exslt.org/)                       -->
+
+<xsl:import href="autoidx.xsl"/>
+<xsl:include href="chunk-common.xsl"/>
+<xsl:include href="chunker.xsl"/>
+
+<!-- ==================================================================== -->
+<!-- What's a chunk?
+
+     The root element (that's it in this version)
+                                                                          -->
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+
+  <xsl:choose>
+    <xsl:when test="not($node/parent::*)">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="set|book|part|preface|chapter|appendix
+                     |article
+                     |reference|refentry
+                     |book/glossary|article/glossary
+                     |book/bibliography|article/bibliography
+                     |sect1|/section|section
+                     |setindex|book/index|article/index
+                     |colophon" priority="2">
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$ischunk = 1">
+      <xsl:call-template name="process-chunk-element"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-imports/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+</xsl:stylesheet>