You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by fu...@apache.org on 2006/09/07 07:50:40 UTC

svn commit: r440984 - in /db/derby/docs/trunk: build.xml lib/dita2fo-links.xsl lib/dita2fo-shell.xsl lib/dita2fo-subroutines.xsl lib/fo2html.xsl src/ref/rreffuncxmlparse.dita src/tools/rtoolsimport64241.dita

Author: fuzzylogic
Date: Wed Sep  6 22:50:39 2006
New Revision: 440984

URL: http://svn.apache.org/viewvc?view=rev&rev=440984
Log:
DERBY-1805: Fix links to element ids in HTML Books and PDFs

Added:
    db/derby/docs/trunk/lib/dita2fo-links.xsl   (with props)
    db/derby/docs/trunk/lib/dita2fo-subroutines.xsl   (with props)
Modified:
    db/derby/docs/trunk/build.xml
    db/derby/docs/trunk/lib/dita2fo-shell.xsl
    db/derby/docs/trunk/lib/fo2html.xsl
    db/derby/docs/trunk/src/ref/rreffuncxmlparse.dita
    db/derby/docs/trunk/src/tools/rtoolsimport64241.dita

Modified: db/derby/docs/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/build.xml?view=diff&rev=440984&r1=440983&r2=440984
==============================================================================
--- db/derby/docs/trunk/build.xml (original)
+++ db/derby/docs/trunk/build.xml Wed Sep  6 22:50:39 2006
@@ -65,6 +65,8 @@
     <copy file="${dita.lib.dir}/dita2fo-titles.xsl" todir="${dita.dir}/xsl/xslfo"/>
     <copy file="${dita.lib.dir}/topic2foImpl.xsl" todir="${dita.dir}/xsl/xslfo"/>
     <copy file="${dita.lib.dir}/domains2fo.xsl" todir="${dita.dir}/xsl/xslfo"/>
+    <copy file="${dita.lib.dir}/dita2fo-links.xsl" todir="${dita.dir}/xsl/xslfo"/>
+    <copy file="${dita.lib.dir}/dita2fo-subroutines.xsl" todir="${dita.dir}/xsl/xslfo"/>
   </target>
  
  <target name="html.workingwithderby" depends="init">

Added: db/derby/docs/trunk/lib/dita2fo-links.xsl
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/lib/dita2fo-links.xsl?view=auto&rev=440984
==============================================================================
--- db/derby/docs/trunk/lib/dita2fo-links.xsl (added)
+++ db/derby/docs/trunk/lib/dita2fo-links.xsl Wed Sep  6 22:50:39 2006
@@ -0,0 +1,159 @@
+<?xml version='1.0'?>
+<!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
+
+<!DOCTYPE xsl:transform [
+<!-- entities for use in the generated output (must produce correctly in FO) -->
+  <!ENTITY bullet        "&#x2022;"><!--check these two for better assignments -->
+]>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
+  <!--==== related-links content subset ====-->
+  <xsl:template match="*[contains(@class,' topic/related-links ')]">
+    <xsl:if test="$output-related-links">
+      <fo:block>
+        <fo:block font-weight="bold">
+          <xsl:text>Related Links</xsl:text>
+        </fo:block>
+        <fo:block>
+          <xsl:attribute name="start-indent">
+            <xsl:value-of select="$basic-start-indent"/>
+          </xsl:attribute>
+          <xsl:apply-templates/>
+        </fo:block>
+      </fo:block>
+    </xsl:if>
+  </xsl:template>
+  <xsl:template 
+    match="*[contains(@class,' topic/linklist ')]/*[contains(@class,' topic/title ')]">
+    <fo:block font-weight="bold">
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+  <xsl:template match="*[contains(@class,' topic/linklist ')]">
+    <fo:block>
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+  <xsl:template match="*[contains(@class,' topic/linkpool ')]">
+    <fo:block>
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+  <xsl:template match="*[contains(@class,' topic/linktext ')]">
+    <fo:inline>
+      <xsl:apply-templates/>
+    </fo:inline>
+  </xsl:template>
+  <!-- rule for when the link is still not pointing at anything -->
+  <xsl:template match="*[contains(@class,' topic/link ')][@href = '']">
+    <fo:block color="red" 
+      start-indent="{$basic-start-indent} + {                    count(ancestor-or-self::*[contains(@class,' topic/linklist ')]) +                    count(ancestor-or-self::*[contains(@class,' topic/linkpool ')])}em">
+      <xsl:text>&bullet; </xsl:text>
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+  <!-- if there is an href, make it look like a link and remove prompt -->
+  <xsl:template match="*[contains(@class,' topic/link ')][not(@href = '')]">
+    <fo:block color="blue" text-decoration="underline" 
+      start-indent="{$basic-start-indent} + {                    count(ancestor-or-self::*[contains(@class,' topic/linklist ')]) +                    count(ancestor-or-self::*[contains(@class,' topic/linkpool ')])}em">
+      <xsl:text>&bullet; </xsl:text>
+      <xsl:apply-templates/>
+    </fo:block>
+  </xsl:template>
+  <!-- ===============  end of related links markup  ================= -->
+  <!-- ===============  xref section (these occur in body) ================= -->
+  <!-- rule for when the xref is still not pointing at anything -->
+  <xsl:template match="*[contains(@class,' topic/xref ')][@href = '']">
+    <fo:inline color="red">
+      <fo:inline font-weight="bold">[xref to: <xsl:value-of 
+        select="@href"/>]</fo:inline>
+      <xsl:apply-templates/>
+    </fo:inline>
+  </xsl:template>
+  <!-- if the xref element contains an href attribute, then create a hyperlink -->
+  <xsl:template match="*[contains(@class,' topic/xref ')][not(@href='')]">
+    <fo:inline color="blue">
+      <xsl:choose>
+        <!-- If the format attribute is dita, or is unspecified, then interpret the href as a topic -->
+        <!-- Create an internal hyperlink to the topic -->
+        <xsl:when test="@format='dita' or @format='DITA' or not(@format)">
+          <fo:basic-link>
+            <!-- Set the destination to the id attribute of the topic referred to by the href -->
+            <xsl:attribute name="internal-destination">
+              <xsl:call-template name="href"/>
+            </xsl:attribute>
+            <!--use content as linktext if it exists, otherwise use href as linktext-->
+            <xsl:choose>
+              <!--use xref content-->
+              <xsl:when test="*|text()">
+                <xsl:apply-templates select="*|text()"/>
+              </xsl:when>
+              <!--use href text-->
+              <xsl:otherwise>
+                <xsl:call-template name="href"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </fo:basic-link>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- If the format attribute is html, then interpret the href as an external link -->
+          <!-- (for example, to a website) -->
+          <xsl:choose>
+            <xsl:when test="@format='html' or @format='HTML'">
+              <fo:basic-link>
+                <xsl:attribute name="external-destination">
+                  <xsl:value-of select="@href"/>
+                </xsl:attribute>
+                <!--use content as linktext if it exists, otherwise use href as linktext-->
+                <xsl:choose>
+                  <!--use xref content-->
+                  <xsl:when test="*|text()">
+                    <xsl:apply-templates select="*|text()"/>
+                  </xsl:when>
+                  <!--use href text-->
+                  <xsl:otherwise>
+                    <xsl:call-template name="href"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </fo:basic-link>
+            </xsl:when>
+            <xsl:otherwise>
+              <!-- xref format not recognized: output xref contents without creating a hyperlink -->
+              <xsl:apply-templates/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:inline>
+  </xsl:template>
+  
+  <xsl:template name="href">
+    <xsl:choose>
+      <!-- If the href contains a # character, then the topic file name is the preceding substring -->
+      <xsl:when test="starts-with(@href,'#')">
+        <xsl:choose>
+          <xsl:when test="contains(substring-after(@href,'#'),'/')">
+            <xsl:value-of select="substring-before(substring-after(@href,'#'),'/')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="substring-after(@href,'#')"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="contains(@href,'#')">
+        <xsl:choose>
+          <xsl:when test="contains(substring-after(@href,'#'),'/')">
+            <xsl:value-of select="substring-after(substring-after(@href,'#'),'/')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="document(substring-before(@href,'#'),/)/*/@id"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="document(@href,/)/*/@id"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- =================== end of related links and xrefs ====================== -->
+</xsl:stylesheet>

Propchange: db/derby/docs/trunk/lib/dita2fo-links.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/docs/trunk/lib/dita2fo-shell.xsl
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/lib/dita2fo-shell.xsl?view=diff&rev=440984&r1=440983&r2=440984
==============================================================================
--- db/derby/docs/trunk/lib/dita2fo-shell.xsl (original)
+++ db/derby/docs/trunk/lib/dita2fo-shell.xsl Wed Sep  6 22:50:39 2006
@@ -93,7 +93,7 @@
       <fox:outline>
         <xsl:attribute name="internal-destination">
           <!-- use id attribute node to generate anchor for PDF bookmark fix bug#1304859 -->
-          <xsl:value-of select="generate-id(@id)"/>
+          <xsl:value-of select="@id"/>
         </xsl:attribute>
         <fox:label>
           <!-- if topic contains navtitle, use that as label for PDF bookmark -->
@@ -390,7 +390,7 @@
        
   </fo:inline>
         <fo:leader leader-pattern="dots"/>
-                <fo:page-number-citation ref-id="{generate-id(@id)}"/>
+                <fo:page-number-citation ref-id="{string(@id)}"/>
     </fo:basic-link>  
 </fo:block>
       <xsl:call-template name="get-tce2-section"/>
@@ -405,7 +405,7 @@
           <xsl:value-of select="*[contains(@class,' topic/title ')]"/>
         </fo:inline>
         <fo:leader leader-pattern="dots"/>
-        <fo:page-number-citation ref-id="{generate-id(@id)}"/>
+        <fo:page-number-citation ref-id="{string(@id)}"/>
         </fo:basic-link>  
  </fo:block>
       <xsl:call-template name="get-tce3-section"/>
@@ -418,7 +418,7 @@
 <fo:basic-link internal-destination="{string(@id)}">
         <xsl:value-of select="*[contains(@class,' topic/title ')]"/>
         <fo:leader leader-pattern="dots"/>
-        <fo:page-number-citation ref-id="{generate-id(@id)}"/>
+        <fo:page-number-citation ref-id="{string(@id)}"/>
            </fo:basic-link>  
    </fo:block>
       <xsl:call-template name="get-tce4-section"/>
@@ -431,7 +431,7 @@
 <fo:basic-link internal-destination="{string(@id)}">
         <xsl:value-of select="*/title"/>
         <fo:leader leader-pattern="dots"/>
-        <fo:page-number-citation ref-id="{generate-id(@id)}"/>
+        <fo:page-number-citation ref-id="{string(@id)}"/>
 	</fo:basic-link>
       </fo:block>
       <xsl:call-template name="get-tce5-section"/>
@@ -444,7 +444,7 @@
 	<fo:basic-link internal-destination="{string(@id)}">
         <xsl:value-of select="*/title"/>
         <fo:leader leader-pattern="dots"/>
-        <fo:page-number-citation ref-id="{generate-id(@id)}"/>
+        <fo:page-number-citation ref-id="{string(@id)}"/>
 	</fo:basic-link>
       </fo:block>
       <!--xsl:call-template name="get-tce6-section"/-->

Added: db/derby/docs/trunk/lib/dita2fo-subroutines.xsl
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/lib/dita2fo-subroutines.xsl?view=auto&rev=440984
==============================================================================
--- db/derby/docs/trunk/lib/dita2fo-subroutines.xsl (added)
+++ db/derby/docs/trunk/lib/dita2fo-subroutines.xsl Wed Sep  6 22:50:39 2006
@@ -0,0 +1,118 @@
+<?xml version='1.0'?>
+<!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version='1.0'>
+
+
+
+<!-- Most of these routines are specific to Print output. For authoring, expose
+     these attributes to direct authoring whereever possible. -->
+
+
+<!-- =================== start of processors  ====================== -->
+
+
+<!--  SET UP KEYS FOR XREF MANAGEMENT  -->
+
+<!-- set up keys based on xref's "type" attribute: %info-types;|hd|fig|table|li|fn -->
+<!-- uses "title"
+<xsl:key name="topic" match="topic" use="@id"/>
+<xsl:key name="fig"   match="fig"   use="@id"/>
+<xsl:key name="table" match="table" use="@id"/> 
+-->
+
+<!-- uses "?"
+<xsl:key name="li"    match="li"    use="@id"/>
+-->
+
+<!-- uses "callout?"
+<xsl:key name="fn"    match="fn"    use="@id"/>
+-->
+
+
+<!--  COMMON ATTRIBUTE PROCESSORS  -->
+
+<!-- If the element has an ID, copy it through as an anchor. -->
+<xsl:template match="@id">
+<!-- Filler for A-name anchors (empty links)-->
+<xsl:variable name="afill"></xsl:variable>
+  <fo:inline>
+    <xsl:attribute name="id">
+      <!--We delete the line to get parent id here -->
+      <xsl:value-of select="."/><!-- generate id according to current node -->
+    </xsl:attribute>
+  <xsl:value-of select="$afill"/></fo:inline>
+</xsl:template>
+
+
+<!-- Generate an ID to use for generated toc. -->
+<xsl:template name="gen-toc-id">
+<!-- Filler for A-name anchors (empty links)-->
+<xsl:variable name="afill"></xsl:variable>
+  <fo:inline id="{generate-id()}"><xsl:value-of select="$afill"/></fo:inline>
+</xsl:template>
+
+
+<!-- Create the class attribute for an element when the DITA element has an outputclass attribute. -->
+<xsl:template name="setclass"/> <!-- turned off for now; not needed for authoring -->
+<xsl:template name="xsetclass">
+  <xsl:if test="@outputclass">
+     <xsl:attribute name="class"><xsl:value-of select="@outputclass"/></xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
+
+<!-- If the element has a compact=yes attribute, assert it in contextually correct form. -->
+<!-- (assumes that no compaction is default) -->
+<xsl:template match="@compact">
+  <xsl:if test="@compact = 'yes'">
+   <!--xsl:attribute name="compact">compact</xsl:attribute-->
+   <!-- NOOP for FO for now; must use padding attributes in block context -->
+  </xsl:if>
+</xsl:template>
+
+<!-- setscale and setframe work are based on text properties. For display-atts
+  used for other content, we'll need to develop content-specific attribute processors -->
+
+<!-- Process the scale attribute for text contexts -->
+<xsl:template name="setscale">
+  <xsl:if test="@scale">
+    <!-- For applications that do not yet take percentages. need to divide by 10 and use "pt" -->
+    <xsl:attribute name="font-size"><xsl:value-of select="@scale div 10"/>pt</xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
+<!-- Process the frame attribute -->
+<!-- frame styles (setframe) must be called within a block that defines the content being framed -->
+<xsl:template name="setframe">
+    <!-- top | topbot -->
+    <xsl:if test="contains(@frame,'top')">
+      <xsl:attribute name="border-top-color">black</xsl:attribute>
+      <xsl:attribute name="border-top-width">thin</xsl:attribute>
+    </xsl:if>
+    <!-- bot | topbot -->
+    <xsl:if test="contains(@frame,'bot')">
+      <xsl:attribute name="border-bottom-color">black</xsl:attribute>
+      <xsl:attribute name="border-bottom-width">thin</xsl:attribute>
+    </xsl:if>
+    <!-- sides -->
+    <xsl:if test="contains(@frame,'sides')">
+      <xsl:attribute name="border-left-color">black</xsl:attribute>
+      <xsl:attribute name="border-left-width">thin</xsl:attribute>
+      <xsl:attribute name="border-right-color">black</xsl:attribute>
+      <xsl:attribute name="border-right-width">thin</xsl:attribute>
+    </xsl:if>
+  <xsl:if test="contains(@frame,'all')">
+    <xsl:attribute name="border-style">solid</xsl:attribute>
+    <xsl:attribute name="border-color">black</xsl:attribute>
+    <xsl:attribute name="border-width">thin</xsl:attribute>
+  </xsl:if> 
+</xsl:template>
+
+<!-- =================== end of override stubs ====================== -->
+
+
+
+</xsl:stylesheet>

Propchange: db/derby/docs/trunk/lib/dita2fo-subroutines.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/docs/trunk/lib/fo2html.xsl
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/lib/fo2html.xsl?view=diff&rev=440984&r1=440983&r2=440984
==============================================================================
--- db/derby/docs/trunk/lib/fo2html.xsl (original)
+++ db/derby/docs/trunk/lib/fo2html.xsl Wed Sep  6 22:50:39 2006
@@ -324,8 +324,8 @@
 </xsl:template>
 
 <xsl:template match="fo:basic-link[@internal-destination]">
-
-  <xsl:variable name="citation-id" select="fo:page-number-citation/@ref-id"/>
+  
+  <xsl:variable name="citation-id" select="@internal-destination"/>
 
   &anchor;<a href="#{$citation-id}">&add-style;<xsl:apply-templates/></a>
 </xsl:template>

Modified: db/derby/docs/trunk/src/ref/rreffuncxmlparse.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rreffuncxmlparse.dita?view=diff&rev=440984&r1=440983&r2=440984
==============================================================================
--- db/derby/docs/trunk/src/ref/rreffuncxmlparse.dita (original)
+++ db/derby/docs/trunk/src/ref/rreffuncxmlparse.dita Wed Sep  6 22:50:39 2006
@@ -18,7 +18,7 @@
 See the License for the specific language governing permissions and  
 limitations under the License.
 -->
-<reference id="rreffuncxmlexists" xml:lang="en-us">
+<reference id="rreffuncxmlparse" xml:lang="en-us">
 <title>XMLPARSE operator</title>
 <shortdesc>XMLPARSE is a SQL/XML operator that you use to parse a character
 string expression into a <ph conref="refconrefs.dita#prod/productshortname"></ph> XML

Modified: db/derby/docs/trunk/src/tools/rtoolsimport64241.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/tools/rtoolsimport64241.dita?view=diff&rev=440984&r1=440983&r2=440984
==============================================================================
--- db/derby/docs/trunk/src/tools/rtoolsimport64241.dita (original)
+++ db/derby/docs/trunk/src/tools/rtoolsimport64241.dita Wed Sep  6 22:50:39 2006
@@ -50,7 +50,7 @@
 a character delimiter.  The specified character is used in place of double
 quotation marks to enclose a character string. You can pass a NULL value to
 use the default value of a double quotation mark.</p></li>
-<li><i id="rtoolsimportcodeset">codeset</i>   <p>Specifies the code set of
+<li><i id="rtoolsimportcodesetarg">codeset</i>   <p>Specifies the code set of
 the data in the input file. The code set name should be one of the Java-supported
 character encoding sets. Data is converted from the specified code set to
 the database code set (<codeph>UTF-8</codeph>). You can pass a NULL value