Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / lib / dita2fo-titles.xsl
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/lib/dita2fo-titles.xsl b/JMCR-Stable/real-world application/derby-10.3.2.1/lib/dita2fo-titles.xsl
new file mode 100644 (file)
index 0000000..461fcce
--- /dev/null
@@ -0,0 +1,246 @@
+<?xml version='1.0'?>\r
+<!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->\r
+\r
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"\r
+                version='1.0'>\r
\r
+\r
+\r
+<!-- =================== start of element rules ====================== -->\r
+\r
+<!-- NESTED TOPIC TITLES (sensitive to nesting depth, but are still processed for contained markup) -->\r
+\r
+<!-- h1 -->\r
+<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]" priority="2">\r
+  <fo:block xsl:use-attribute-sets="topictitle1" id="{generate-id()}" padding-top="1.4pc">\r
+    <fo:block border-top-color="black" border-top-width="3pt" line-height="100%"\r
+              border-left-width="0pt" border-right-width="0pt">\r
+      <xsl:call-template name="get-title"/>\r
+    </fo:block>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+\r
+<!-- h2 -->\r
+<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]" priority="3">\r
+  <fo:block xsl:use-attribute-sets="topictitle2" id="{generate-id()}" padding-top="1pc">\r
+    <fo:block border-top-color="black" border-top-width="1pt"\r
+              border-left-width="0pt" border-right-width="0pt">\r
+      <xsl:call-template name="get-title"/>\r
+    </fo:block>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+<!-- h3 -->\r
+<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]" priority="4">\r
+  <fo:block xsl:use-attribute-sets="topictitle3" id="{generate-id()}">\r
+    <xsl:call-template name="get-title"/>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+<!-- h4 -->\r
+<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]" priority="5">\r
+  <fo:block xsl:use-attribute-sets="topictitle4" id="{generate-id()}">\r
+    <xsl:if test="$trace='yes'"><fo:inline color="purple"></fo:inline></xsl:if>\r
+    <xsl:call-template name="get-title"/>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+<!-- h5 -->\r
+<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]" priority="6">\r
+  <fo:block xsl:use-attribute-sets="topictitle5" id="{generate-id()}">\r
+    <xsl:call-template name="get-title"/><xsl:text>: </xsl:text>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+<!-- h6 -->\r
+<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]" priority="7">\r
+  <fo:block xsl:use-attribute-sets="topictitle6" id="{generate-id()}">\r
+    <xsl:call-template name="get-title"/><xsl:text>: </xsl:text>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+\r
+\r
+\r
+\r
+<!-- section/title handling -->\r
+\r
+<xsl:template match="*[contains(@class,' topic/section ')]/*[contains(@class,' topic/title ')]">\r
+  <fo:block font-weight="bold">\r
+    <xsl:apply-templates/>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+\r
+<!-- example/title handing -->\r
+\r
+<xsl:template match="*[contains(@class,' topic/example ')]/*[contains(@class,' topic/title ')]">\r
+  <fo:block font-weight="bold">\r
+    <xsl:apply-templates/>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+\r
+<!-- table/title handling -->\r
+\r
+<xsl:template match="*[contains(@class,' topic/table ')]/*[contains(@class,' topic/title ')]">\r
+  <xsl:variable name="tbl-pfx-txt">\r
+    <xsl:call-template name="getString">\r
+      <xsl:with-param name="stringName" select="'Table'"/>\r
+    </xsl:call-template>\r
+    <xsl:text> </xsl:text>\r
+    <xsl:value-of select="count(preceding::*[contains(@class,' topic/table ')]/*[contains(@class,' topic/title ')])+1"/>\r
+  </xsl:variable>\r
+  <fo:block font-weight="bold">\r
+    <fo:inline color="red"><xsl:value-of select="$tbl-pfx-txt"/>. </fo:inline>\r
+    <xsl:apply-templates/>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+\r
+<!-- fig/title handling -->\r
+\r
+<xsl:template match="*[contains(@class,' topic/fig ')]/*[contains(@class,' topic/title ')]">\r
+  <xsl:variable name="fig-pfx-txt">\r
+    <xsl:call-template name="getString">\r
+      <xsl:with-param name="stringName" select="'Figure'"/>\r
+    </xsl:call-template>\r
+    <xsl:text> </xsl:text>\r
+    <xsl:value-of select="count(preceding::*[contains(@class,' topic/fig ')]/*[contains(@class,' topic/title ')])+1"/>\r
+  </xsl:variable>\r
+  <fo:block font-weight="bold">\r
+    <fo:inline color="red"><xsl:value-of select="$fig-pfx-txt"/>. </fo:inline>\r
+    <xsl:apply-templates/>\r
+  </fo:block>\r
+</xsl:template>\r
+\r
+\r
+\r
+\r
+<xsl:template name="place-tbl-lbl">\r
+<xsl:variable name="tbl-count">                  <!-- Number of table/title's before this one -->\r
+ <xsl:number count="*/table/title" level="multiple"/> <!-- was ANY-->\r
+</xsl:variable>\r
+<xsl:variable name="tbl-count-actual">           <!-- Number of table/title's including this one -->\r
+ <xsl:choose>\r
+   <xsl:when test="not($tbl-count&gt;0) and not($tbl-count=0) and not($tbl-count&lt;0)">1</xsl:when>\r
+   <xsl:otherwise><xsl:value-of select="$tbl-count+1"/></xsl:otherwise>\r
+ </xsl:choose>\r
+</xsl:variable>\r
+  <xsl:choose>\r
+    <xsl:when test="*[contains(@class,' topic/title ')]">\r
+      <fo:block><fo:inline font-weight="bold">\r
+        <xsl:call-template name="getString">\r
+         <xsl:with-param name="stringName" select="'Table'"/>\r
+        </xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="$tbl-count-actual"/>.<xsl:text> </xsl:text>\r
+        <xsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="exhibittitle"/>\r
+      </fo:inline>\r
+      <xsl:if test="*[contains(@class,' topic/desc ')]">\r
+        <xsl:text>. </xsl:text><xsl:apply-templates select="*[contains(@class,' topic/desc ')]" mode="exhibitdesc"/>\r
+      </xsl:if>\r
+      </fo:block>\r
+    </xsl:when>\r
+    <xsl:when test="*[contains(@class,' topic/desc ')]">\r
+      <fo:block>****<xsl:value-of select="*[contains(@class,' topic/desc ')]"/></fo:block>\r
+    </xsl:when>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template name="place-fig-lbl">\r
+<xsl:variable name="fig-count">                 <!-- Number of fig/title's before this one -->\r
+ <xsl:number count="*/fig/title" level="multiple"/>\r
+</xsl:variable>\r
+<xsl:variable name="fig-count-actual">          <!-- Number of fig/title's including this one -->\r
+ <xsl:choose>\r
+   <xsl:when test="not($fig-count&gt;0) and not($fig-count=0) and not($fig-count&lt;0)">1</xsl:when>\r
+   <xsl:otherwise><xsl:value-of select="$fig-count+1"/></xsl:otherwise>\r
+ </xsl:choose>\r
+</xsl:variable>\r
+  <xsl:choose>\r
+    <xsl:when test="*[contains(@class,' topic/title ')]">\r
+      <fo:block><fo:inline font-weight="bold">\r
+        <xsl:call-template name="getString">\r
+          <xsl:with-param name="stringName" select="'Figure'"/>\r
+        </xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="$fig-count-actual"/>.<xsl:text> </xsl:text>\r
+        <xsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="exhibittitle"/>\r
+      </fo:inline>\r
+      <xsl:if test="desc">\r
+        <xsl:text>. </xsl:text><xsl:apply-templates select="*[contains(@class,' topic/desc ')]" mode="exhibitdesc"/>\r
+      </xsl:if>\r
+      </fo:block>\r
+    </xsl:when>\r
+    <xsl:when test="*[contains(@class, ' topic/desc ')]">\r
+      <fo:block>****<xsl:value-of select="*[contains(@class,' topic/desc ')]"/></fo:block>\r
+    </xsl:when>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+\r
+\r
+<!-- ======== NAMED TEMPLATES for labels and titles related to topic structures ======== -->\r
+\r
+<xsl:template name="get-title"><!-- get fully-processed title content by whatever mechanism -->\r
+   <!-- insert anchor for PDF bookmark, using id attribute of topic element -->\r
+   <!-- inserting the anchor here ensures that it is on the same page as the topic title, not the page before -->\r
+   <xsl:apply-templates select="parent::*/@id"/>\r
+   <xsl:choose>\r
+   <!-- add keycol here once implemented -->\r
+   <xsl:when test="@spectitle">\r
+     <xsl:value-of select="@spectitle"/>\r
+   </xsl:when>\r
+   <xsl:otherwise>\r
+    <xsl:apply-templates/> <!-- select="title|*[contains(@class,' topic/title ')]"/-->\r
+   </xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+\r
+\r
+<xsl:template name="get-sect-heading">\r
+     <xsl:choose>\r
+      <!-- replace with keyref once implemented -->\r
+      <xsl:when test="@spectitle">\r
+        <xsl:value-of select="@spectitle"/>\r
+      </xsl:when>\r
+      <xsl:otherwise>\r
+        <xsl:apply-templates select="title"/>\r
+      </xsl:otherwise>\r
+     </xsl:choose>\r
+</xsl:template>\r
+\r
+\r
+<xsl:template name="sect-heading">\r
+  <xsl:param name="deftitle" select="."/> <!-- get param by reference -->\r
+  <xsl:variable name="heading">\r
+     <xsl:choose>\r
+      <xsl:when test="*[contains(@class,' topic/title ')]">\r
+        <xsl:value-of select="*[contains(@class,' topic/title ')]"/>\r
+      </xsl:when>\r
+      <xsl:when test="@spectitle">\r
+        <xsl:value-of select="@spectitle"/>\r
+      </xsl:when>\r
+      <xsl:otherwise/>\r
+     </xsl:choose>\r
+  </xsl:variable>\r
+\r
+  <!-- based on graceful defaults, build an appropriate section-level heading -->\r
+  <xsl:choose>\r
+    <xsl:when test="not($heading='')">\r
+      <xsl:if test="normalize-space($heading)=''">\r
+        <!-- hack: a title with whitespace ALWAYS overrides as null -->\r
+        <!--xsl:comment>no heading</xsl:comment-->\r
+      </xsl:if>\r
+      <!--xsl:call-template name="proc-ing"/--><xsl:value-of select="$heading"/>\r
+    </xsl:when>\r
+    <xsl:when test="$deftitle">\r
+      <xsl:value-of select="$deftitle"/>\r
+    </xsl:when>\r
+    <xsl:otherwise><!-- no heading title, output section starting with a break --></xsl:otherwise>\r
+  </xsl:choose>\r
+</xsl:template>\r
+\r
+\r
+</xsl:stylesheet>\r