chunkfast.xsl 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?xml version="1.0" encoding="ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="cf exsl">
  5. <!-- ********************************************************************
  6. $Id$
  7. ********************************************************************
  8. This file is part of the XSL DocBook Stylesheet distribution.
  9. See ../README or http://docbook.sf.net/release/xsl/current/ for
  10. copyright and other information.
  11. ******************************************************************** -->
  12. <!-- ==================================================================== -->
  13. <xsl:import href="chunk.xsl"/>
  14. <xsl:param name="chunk.fast" select="1"/>
  15. <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
  16. <!-- ==================================================================== -->
  17. <xsl:template name="process-chunk-element">
  18. <xsl:choose>
  19. <xsl:when test="$chunk.fast != 0 and function-available('exsl:node-set')">
  20. <xsl:variable name="genid" select="generate-id()"/>
  21. <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
  22. <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
  23. <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
  24. <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
  25. <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
  26. <xsl:choose>
  27. <xsl:when test="$onechunk != 0 and parent::*">
  28. <xsl:apply-imports/>
  29. </xsl:when>
  30. <xsl:otherwise>
  31. <xsl:call-template name="process-chunk">
  32. <xsl:with-param name="prev" select="$prev"/>
  33. <xsl:with-param name="next" select="$next"/>
  34. </xsl:call-template>
  35. </xsl:otherwise>
  36. </xsl:choose>
  37. </xsl:when>
  38. <xsl:otherwise>
  39. <xsl:choose>
  40. <xsl:when test="$onechunk != 0 and not(parent::*)">
  41. <xsl:call-template name="chunk-all-sections"/>
  42. </xsl:when>
  43. <xsl:when test="$onechunk != 0">
  44. <xsl:apply-imports/>
  45. </xsl:when>
  46. <xsl:when test="$chunk.first.sections = 0">
  47. <xsl:call-template name="chunk-first-section-with-parent"/>
  48. </xsl:when>
  49. <xsl:otherwise>
  50. <xsl:call-template name="chunk-all-sections"/>
  51. </xsl:otherwise>
  52. </xsl:choose>
  53. </xsl:otherwise>
  54. </xsl:choose>
  55. </xsl:template>
  56. </xsl:stylesheet>