Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Apr 2013 16:40:33 +0000 (UTC)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        doc-committers@freebsd.org, svn-doc-projects@freebsd.org
Subject:   svn commit: r41387 - projects/xml-tools/share/xsl
Message-ID:  <201304061640.r36GeXYe055741@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gabor
Date: Sat Apr  6 16:40:32 2013
New Revision: 41387
URL: http://svnweb.freebsd.org/changeset/doc/41387

Log:
  - Make bridgehead actually render as specified in the renderas attribute

Modified:
  projects/xml-tools/share/xsl/freebsd-xhtml-common.xsl

Modified: projects/xml-tools/share/xsl/freebsd-xhtml-common.xsl
==============================================================================
--- projects/xml-tools/share/xsl/freebsd-xhtml-common.xsl	Sat Apr  6 15:43:09 2013	(r41386)
+++ projects/xml-tools/share/xsl/freebsd-xhtml-common.xsl	Sat Apr  6 16:40:32 2013	(r41387)
@@ -47,6 +47,72 @@
     For questions about this documentation, e-mail &lt;<a href="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&gt;.</small></p>
   </xsl:template>
 
+  <!-- Add title class to emitted hX -->
+  <xsl:template match="bridgehead">
+    <xsl:variable name="container" select="(ancestor::appendix|ancestor::article|ancestor::bibliography|
+      ancestor::chapter|ancestor::glossary|ancestor::glossdiv|ancestor::index|ancestor::partintro|
+      ancestor::preface|ancestor::refsect1|ancestor::refsect2|ancestor::refsect3|ancestor::sect1|
+      ancestor::sect2|ancestor::sect3|ancestor::sect4|ancestor::sect5|ancestor::section|ancestor::setindex|
+      ancestor::simplesect)[last()]"/>
+
+    <xsl:variable name="clevel">
+      <xsl:choose>
+        <xsl:when test="local-name($container) = 'appendix'
+	  or local-name($container) = 'chapter'
+	  or local-name($container) = 'article'
+	  or local-name($container) = 'bibliography'
+	  or local-name($container) = 'glossary'
+	  or local-name($container) = 'index'
+	  or local-name($container) = 'partintro'
+	  or local-name($container) = 'preface'
+	  or local-name($container) = 'setindex'">1</xsl:when>
+        <xsl:when test="local-name($container) = 'glossdiv'">
+          <xsl:value-of select="count(ancestor::glossdiv)+1"/>
+        </xsl:when>
+        <xsl:when test="local-name($container) = 'sect1'
+	  or local-name($container) = 'sect2'
+	  or local-name($container) = 'sect3'
+	  or local-name($container) = 'sect4'
+	  or local-name($container) = 'sect5'
+	  or local-name($container) = 'refsect1'
+	  or local-name($container) = 'refsect2'
+	  or local-name($container) = 'refsect3'
+	  or local-name($container) = 'section'
+	  or local-name($container) = 'simplesect'">
+          <xsl:variable name="slevel">
+            <xsl:call-template name="section.level">
+              <xsl:with-param name="node" select="$container"/>
+            </xsl:call-template>
+          </xsl:variable>
+          <xsl:value-of select="$slevel + 1"/>
+        </xsl:when>
+        <xsl:otherwise>1</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- HTML H level is one higher than section level -->
+    <xsl:variable name="hlevel">
+      <xsl:choose>
+        <xsl:when test="@renderas = 'sect1'">2</xsl:when>
+        <xsl:when test="@renderas = 'sect2'">3</xsl:when>
+        <xsl:when test="@renderas = 'sect3'">4</xsl:when>
+        <xsl:when test="@renderas = 'sect4'">5</xsl:when>
+        <xsl:when test="@renderas = 'sect5'">6</xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$clevel + 1"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">;
+      <xsl:attribute name="class">title</xsl:attribute>
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+
   <xsl:template name="svnref.genlink">
     <xsl:param name="rev" select="."/>
     <xsl:param name="repo" select="'base'"/>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304061640.r36GeXYe055741>