List:Commits« Previous MessageNext Message »
From:paul Date:October 2 2007 7:02pm
Subject:svn commit - mysqldoc@docsrva: r7946 - in trunk: . refman-5.2 xsl.d
View as plain text  
Author: paul
Date: 2007-10-02 21:02:47 +0200 (Tue, 02 Oct 2007)
New Revision: 7946

Log:
 r30608@polar:  paul | 2007-10-02 14:01:05 -0500
 Enable a few SQL function auto-links.


Modified:
   trunk/refman-5.2/functions-core.xml
   trunk/xsl.d/dbk-prep.xsl

Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:30603
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:25178
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:20005
   + 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:30608
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:25178
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:20005


Modified: trunk/refman-5.2/functions-core.xml
===================================================================
--- trunk/refman-5.2/functions-core.xml	2007-10-02 19:02:32 UTC (rev 7945)
+++ trunk/refman-5.2/functions-core.xml	2007-10-02 19:02:47 UTC (rev 7946)
Changed blocks: 5, Lines Added: 17, Lines Deleted: 13; 2966 bytes

@@ -242,8 +242,10 @@
       <para>
         It is also possible to perform explicit conversions. If you want
         to convert a number to a string explicitly, use the
-        <literal>CAST()</literal> or <literal>CONCAT()</literal>
-        function (<literal>CAST()</literal> is preferable):
+        <function role="sql">CAST()</function> or
+        <function
+role="sql">CONCAT()</function> function
+        (<function role="sql">CAST()</function> is preferable):
       </para>
 
 <programlisting>

@@ -308,8 +310,9 @@
             a constant, the constant is converted to a timestamp before
             the comparison is performed. This is done to be more
             ODBC-friendly. Note that this is not done for the arguments
-            to <literal>IN()</literal>! To be safe, always use complete
-            datetime, date, or time strings when doing comparisons.
+            to <function role="sql">IN()</function>! To be safe, always
+            use complete datetime, date, or time strings when doing
+            comparisons.
           </para>
         </listitem>
 

@@ -394,8 +397,9 @@
         The results shown will vary on different systems, and can be
         affected by factors such as computer architecture or the
         compiler version or optimization level. One way to avoid such
-        problems is to use <literal>CAST()</literal> so that a value
-        will not be converted implicitly to a float-point number:
+        problems is to use <function role="sql">CAST()</function> so
+        that a value will not be converted implicitly to a float-point
+        number:
       </para>
 
 <programlisting>

@@ -5386,10 +5390,10 @@
 
         <listitem>
           <para>
-            In the case of <literal>-</literal>,
-            <literal>+</literal>, and <literal>*</literal>, the result
-            is calculated with <literal>BIGINT</literal> (64-bit)
-            precision if both arguments are integers.
+            In the case of <literal>-</literal>, <literal>+</literal>,
+            and <literal>*</literal>, the result is calculated with
+            <literal>BIGINT</literal> (64-bit) precision if both
+            arguments are integers.
           </para>
         </listitem>
 

@@ -5435,9 +5439,9 @@
       </para>
 
       <para>
-        Because of these rules and the way they are applied, care
-        should be taken to ensure that components and sub-components of
-        a calculation use the appropriate level of precision. See
+        Because of these rules and the way they are applied, care should
+        be taken to ensure that components and sub-components of a
+        calculation use the appropriate level of precision. See
         <xref linkend="cast-functions"/>.
       </para>
 


Modified: trunk/xsl.d/dbk-prep.xsl
===================================================================
--- trunk/xsl.d/dbk-prep.xsl	2007-10-02 19:02:32 UTC (rev 7945)
+++ trunk/xsl.d/dbk-prep.xsl	2007-10-02 19:02:47 UTC (rev 7946)
Changed blocks: 3, Lines Added: 49, Lines Deleted: 1; 3044 bytes

@@ -38,6 +38,9 @@
   - Map other <remark> elements to <para> if $map.remark.to.para is
     non-zero. (But only for remarks that have no special purpose.)
   - Strip advertisements if $strip.ads is non-zero.
+  - Map <function role="xxx">function_name()</function> elements onto
+    links to the section where function_name is described, for xxx values
+    of "capi" (C API function), "sql" (SQL function).
 
   It is REQUIRED that processing instructions be preserved, because we
   use the <?dbtimestamp?> PI to produce a timestamp in the stylesheets

@@ -251,7 +254,6 @@
       - If there is a section with that name, wrap the function element
         within a link to that section (unless it is already within a link).
       - Otherwise, don't produce a link; write the function element as is.
-      TODO: echo all attributes *except* "role"?
      -->
     <xsl:variable
       name="fname"

@@ -284,6 +286,52 @@
     </xsl:choose>
   </xsl:template>
 
+  <xsl:template match="function[@role='sql']">
+    <!--
+      - Get function name (element content up to leading open paren),
+        with underscores converted to dashes and converted to lowercase.
+      - If there is an ID corresponding to that name, wrap the function
+        element within a link to that ID (unless it is already within a link).
+        For SQL functions, the ID will have a "function_" prefix.
+        Example: For FIND_IN_SET(), the ID will be function_find-in-set.
+      - Otherwise, don't produce a link; write the function element as is.
+     -->
+    <xsl:variable
+      name="fname"
+      select="concat('function_',
+                     translate(substring-before(normalize-space(.),'('),
+                        '_ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+                        '-abcdefghijklmnopqrstuvwxyz'))"/>
+<xsl:message>FUNCTION: <xsl:value-of select="."/></xsl:message>
+<xsl:message>ID: <xsl:value-of select="$fname"/></xsl:message>
+    <xsl:choose>
+      <xsl:when test="key('all.ids',$fname) and not(parent::link)">
+        <link>
+          <xsl:attribute name="linkend">
+            <xsl:value-of select="$fname"/>
+          </xsl:attribute>
+          <function>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates/>
+        </function>
+        </link>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- display warning if we got here because no ID was found -->
+        <xsl:if test="not(key('all.ids',$fname))">
+          <xsl:message>
+            <xsl:text>Warning: no target found for SQL function reference </xsl:text>
+            <xsl:value-of select="$fname"/>
+          </xsl:message>
+        </xsl:if>
+        <function>
+          <xsl:copy-of select="@*"/>
+          <xsl:apply-templates/>
+        </function>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <!--
   Map glossary tags to variable list
 -->


Thread
svn commit - mysqldoc@docsrva: r7946 - in trunk: . refman-5.2 xsl.dpaul2 Oct