Author: paul
Date: 2007-01-11 18:59:06 +0100 (Thu, 11 Jan 2007)
New Revision: 4452
Log:
r17967@polar: paul | 2007-01-11 11:52:38 -0600
New transform for generating TOC files for GUI help files.
Added:
trunk/xsl.d/mysql-guihelp-toc.xsl
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:17918
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:14416
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:13015
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:17967
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:14416
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:13015
Added: trunk/xsl.d/mysql-guihelp-toc.xsl
===================================================================
--- trunk/xsl.d/mysql-guihelp-toc.xsl (rev 0)
+++ trunk/xsl.d/mysql-guihelp-toc.xsl 2007-01-11 17:59:06 UTC (rev 4452)
Changed blocks: 1, Lines Added: 110, Lines Deleted: 0; 3421 bytes
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+
+<!--
+ mysql-guihelp-toc.xsl - generate XML "TOC" files for GUI help files
+
+ extract.list.items should be 1 if the output should contain
+ entries extracted from list items. This is used for extracting
+ information from individual function descriptions in the functions
+ file.
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="xml"/>
+
+<xsl:param name="extract.list.items" select="0"/>
+
+<!-- define variable that contains a newline character -->
+<xsl:variable name="newline" select="'
'"/>
+
+<xsl:template match="section">
+ <xsl:variable name="depth" select="count(ancestor-or-self::section)"/>
+ <xsl:choose>
+ <xsl:when test="$depth=1">
+ <functiongroup>
+ <xsl:attribute name="name">
+ <xsl:value-of select="normalize-space(title)"/>
+ </xsl:attribute>
+ <xsl:if test="section|itemizedlist">
+ <xsl:value-of select="$newline"/>
+ <xsl:apply-templates select="section|itemizedlist"/>
+ </xsl:if>
+ </functiongroup>
+ <xsl:value-of select="$newline"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <function>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ <xsl:attribute name="caption">
+ <xsl:value-of select="normalize-space(title)"/>
+ </xsl:attribute>
+ <xsl:if test="section|itemizedlist">
+ <xsl:value-of select="$newline"/>
+ <xsl:apply-templates select="section|itemizedlist"/>
+ </xsl:if>
+ </function>
+ <xsl:value-of select="$newline"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="itemizedlist">
+ <xsl:if test="$extract.list.items != 0">
+ <xsl:apply-templates select="listitem/para[1]" mode="extract"/>
+ </xsl:if>
+</xsl:template>
+
+<!--
+ Individual functions descriptions are marked up as itemizedlist/listitem
+ elements. The first para of each item should have this format:
+
+ <para id="function_xxx">
+ ...
+ <literal>function syntax</literal>
+ </para>
+
+ - Extract the id attribute as the id of the output element.
+ - Extract the content of the literal element as the caption of the
+ output element.
+-->
+
+<xsl:template match="para[1]" mode="extract">
+ <!-- ignore para unless it has an @id attribute and a literal element -->
+ <xsl:if test="@id and literal">
+ <functionx>
+ <xsl:attribute name="caption">
+ <xsl:value-of select="normalize-space(literal[1])"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </functionx>
+ <xsl:value-of select="$newline"/>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="*">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<!--
+ Put out a root element explicitly. This will include the xmlns
+ declaration (sigh), but also has the effect that no such declaration
+ will be emitted for elements contained within this one.
+-->
+
+<xsl:template match="/">
+ <functionindex>
+ <xsl:value-of select="$newline"/>
+ <xsl:apply-templates/>
+ </functionindex>
+</xsl:template>
+
+<xsl:template match="text()"/>
+
+</xsl:stylesheet>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r4452 - in trunk: . xsl.d | paul | 11 Jan |