component.title.xsl 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <xsl:stylesheet version="1.0"
  2. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:d="http://docbook.org/ns/docbook"
  4. xmlns="http://www.w3.org/1999/xhtml"
  5. exclude-result-prefixes="d">
  6. <xsl:template name="component.title">
  7. <xsl:param name="node" select="."/>
  8. <xsl:variable name="level">
  9. <xsl:choose>
  10. <xsl:when test="ancestor::d:section">
  11. <xsl:value-of select="count(ancestor::d:section)+1"/>
  12. </xsl:when>
  13. <xsl:when test="ancestor::d:sect5">6</xsl:when>
  14. <xsl:when test="ancestor::d:sect4">5</xsl:when>
  15. <xsl:when test="ancestor::d:sect3">4</xsl:when>
  16. <xsl:when test="ancestor::d:sect2">3</xsl:when>
  17. <xsl:when test="ancestor::d:sect1">2</xsl:when>
  18. <xsl:otherwise>1</xsl:otherwise>
  19. </xsl:choose>
  20. </xsl:variable>
  21. <xsl:element name="h{$level+1}" namespace="http://www.w3.org/1999/xhtml">
  22. <xsl:attribute name="class">title</xsl:attribute>
  23. <xsl:if test="$generate.id.attributes = 0">
  24. <xsl:call-template name="anchor">
  25. <xsl:with-param name="node" select="$node"/>
  26. <xsl:with-param name="conditional" select="0"/>
  27. </xsl:call-template>
  28. </xsl:if>
  29. <xsl:apply-templates select="$node" mode="object.title.markup">
  30. <xsl:with-param name="allow-anchors" select="1"/>
  31. </xsl:apply-templates>
  32. <xsl:call-template name="permalink">
  33. <xsl:with-param name="node" select="$node"/>
  34. </xsl:call-template>
  35. </xsl:element>
  36. </xsl:template>
  37. </xsl:stylesheet>