| 1 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 2 |
xmlns:d="http://docbook.org/ns/docbook" |
| 3 |
xmlns:exsl="http://exslt.org/common" |
| 4 |
xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" |
| 5 |
version="1.0" |
| 6 |
exclude-result-prefixes="exsl cf d"> |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
<xsl:import href="changebars.xsl"/> |
| 22 |
<xsl:import href="chunk-common.xsl"/> |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
<xsl:template name="process-chunk-element"> |
| 27 |
<xsl:param name="content"> |
| 28 |
<xsl:choose> |
| 29 |
|
| 30 |
<xsl:when test="ancestor-or-self::*[@revisionflag] and $show.revisionflag != 0"> |
| 31 |
<xsl:variable name="revisionflag" select="ancestor-or-self::*[@revisionflag][1]/@revisionflag" /> |
| 32 |
<xsl:call-template name="block.or.inline.revision"> |
| 33 |
<xsl:with-param name="revisionflag" select="$revisionflag"/> |
| 34 |
</xsl:call-template> |
| 35 |
</xsl:when> |
| 36 |
|
| 37 |
<xsl:otherwise> |
| 38 |
<xsl:apply-imports/> |
| 39 |
</xsl:otherwise> |
| 40 |
</xsl:choose> |
| 41 |
</xsl:param> |
| 42 |
|
| 43 |
<xsl:choose> |
| 44 |
<xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0"> |
| 45 |
<xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/> |
| 46 |
<xsl:variable name="genid" select="generate-id()"/> |
| 47 |
|
| 48 |
<xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/> |
| 49 |
|
| 50 |
<xsl:variable name="prevdiv" |
| 51 |
select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/> |
| 52 |
<xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/> |
| 53 |
|
| 54 |
<xsl:variable name="nextdiv" |
| 55 |
select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/> |
| 56 |
<xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/> |
| 57 |
|
| 58 |
<xsl:choose> |
| 59 |
<xsl:when test="$onechunk != 0 and parent::*"> |
| 60 |
<xsl:copy-of select="$content"/> |
| 61 |
</xsl:when> |
| 62 |
<xsl:otherwise> |
| 63 |
<xsl:call-template name="process-chunk"> |
| 64 |
<xsl:with-param name="prev" select="$prev"/> |
| 65 |
<xsl:with-param name="next" select="$next"/> |
| 66 |
<xsl:with-param name="content" select="$content"/> |
| 67 |
</xsl:call-template> |
| 68 |
</xsl:otherwise> |
| 69 |
</xsl:choose> |
| 70 |
</xsl:when> |
| 71 |
<xsl:otherwise> |
| 72 |
<xsl:choose> |
| 73 |
<xsl:when test="$onechunk != 0 and not(parent::*)"> |
| 74 |
<xsl:call-template name="chunk-all-sections"> |
| 75 |
<xsl:with-param name="content" select="$content"/> |
| 76 |
</xsl:call-template> |
| 77 |
</xsl:when> |
| 78 |
<xsl:when test="$onechunk != 0"> |
| 79 |
<xsl:copy-of select="$content"/> |
| 80 |
</xsl:when> |
| 81 |
<xsl:when test="$chunk.first.sections = 0"> |
| 82 |
<xsl:call-template name="chunk-first-section-with-parent"> |
| 83 |
<xsl:with-param name="content" select="$content"/> |
| 84 |
</xsl:call-template> |
| 85 |
</xsl:when> |
| 86 |
<xsl:otherwise> |
| 87 |
<xsl:call-template name="chunk-all-sections"> |
| 88 |
<xsl:with-param name="content" select="$content"/> |
| 89 |
</xsl:call-template> |
| 90 |
</xsl:otherwise> |
| 91 |
</xsl:choose> |
| 92 |
</xsl:otherwise> |
| 93 |
</xsl:choose> |
| 94 |
</xsl:template> |
| 95 |
|
| 96 |
<xsl:include href="chunk-code.xsl"/> |
| 97 |
|
| 98 |
</xsl:stylesheet> |