[yelp-xsl] Added some missing API docs and shifted a few things around



commit d0f4e44815a24fae5fb3f2d40320ba4160313217
Author: Shaun McCance <shaunm gnome org>
Date:   Thu Jul 23 19:56:26 2015 -0400

    Added some missing API docs and shifted a few things around

 test/testbook/testbook.xml             |    6 +++
 xslt/docbook/common/db-chunk.xsl       |   17 ++++----
 xslt/docbook/common/db-common.xsl      |   67 ++++++++++++++++++++++++++++++++
 xslt/docbook/html/db2html-division.xsl |    2 +-
 xslt/docbook/html/db2html-inline.xsl   |   40 +++----------------
 xslt/mallard/common/mal-gloss.xsl      |    8 ++++
 xslt/mallard/common/mal-link.xsl       |    7 +++-
 7 files changed, 103 insertions(+), 44 deletions(-)
---
diff --git a/test/testbook/testbook.xml b/test/testbook/testbook.xml
index a65c369..e3636d5 100644
--- a/test/testbook/testbook.xml
+++ b/test/testbook/testbook.xml
@@ -1869,6 +1869,12 @@ porttitor condimentum nulla.</para>
           or keyboard.</para>
         </glossdef>
       </glossentry>
+      <glossentry id="gloss-button">
+        <glossterm>button</glossterm>
+        <glossdef>
+          <para>The thing you press.</para>
+        </glossdef>
+      </glossentry>
       <glossentry>
         <glossterm>desktop</glossterm>
         <glossdef>
diff --git a/xslt/docbook/common/db-chunk.xsl b/xslt/docbook/common/db-chunk.xsl
index 625e665..2e7ef15 100644
--- a/xslt/docbook/common/db-chunk.xsl
+++ b/xslt/docbook/common/db-chunk.xsl
@@ -35,13 +35,12 @@ A space-seperated list of the names of elements that should be chunked.
 
 REMARK: This parameter sucks
 -->
-<xsl:param name="db.chunk.chunks" select="
-           'appendix    article     bibliography  bibliodiv  book    chapter
+<xsl:param name="db.chunk.chunks" select="'
+            appendix    article     bibliography  bibliodiv  book    chapter
             colophon    dedication  glossary      glossdiv   index
             lot         part        preface       refentry   reference
             sect1       sect2       sect3         sect4      sect5
-            section     setindex    simplesect    toc'"/>
-<xsl:variable name="db.chunk.chunks_" select="concat(' ', $db.chunk.chunks, ' ')"/>
+            section     setindex    simplesect    toc        '"/>
 
 
 <!--@@==========================================================================
@@ -179,7 +178,7 @@ REMARK: Explain how this works
   <xsl:param name="node" select="."/>
   <xsl:variable name="divs"
                 select="$node/ancestor-or-self::*
-                         [contains($db.chunk.chunks_,
+                         [contains($db.chunk.chunks,
                             concat(' ', local-name(.), ' '))]"/>
   <xsl:choose>
     <xsl:when test="count($divs) - 1 &lt; $db.chunk.max_depth">
@@ -263,7 +262,7 @@ REMARK: Explain how this works, and what the axes are
     <xsl:when test="$axis = 'following'">
       <xsl:variable name="divs"
                     select="$node/following-sibling::*
-                             [contains($db.chunk.chunks_,
+                             [contains($db.chunk.chunks,
                                 concat(' ', local-name(.), ' '))]"/>
       <xsl:choose>
         <xsl:when test="$divs">
@@ -286,7 +285,7 @@ REMARK: Explain how this works, and what the axes are
     <!-- last-descendant -->
     <xsl:when test="$axis = 'last-descendant'">
       <xsl:variable name="divs"
-                    select="$node/*[contains($db.chunk.chunks_,
+                    select="$node/*[contains($db.chunk.chunks,
                                       concat(' ', local-name(.), ' '))]"/>
       <xsl:choose>
         <xsl:when test="($depth_of_chunk &gt;= $db.chunk.max_depth)">
@@ -323,7 +322,7 @@ REMARK: Explain how this works, and what the axes are
     <!-- next -->
     <xsl:when test="$axis = 'next'">
       <xsl:variable name="divs"
-                    select="$node/*[contains($db.chunk.chunks_,
+                    select="$node/*[contains($db.chunk.chunks,
                                       concat(' ', local-name(.), ' '))]"/>
       <xsl:choose>
         <xsl:when test="($depth_of_chunk &lt; $db.chunk.max_depth) and $divs">
@@ -347,7 +346,7 @@ REMARK: Explain how this works, and what the axes are
     <xsl:when test="$axis = 'previous'">
       <xsl:variable name="divs"
                     select="$node/preceding-sibling::*
-                             [contains($db.chunk.chunks_,
+                             [contains($db.chunk.chunks,
                                 concat(' ', local-name(.), ' '))]"/>
       <xsl:choose>
         <xsl:when test="$divs and ($depth_of_chunk &lt; $db.chunk.max_depth)">
diff --git a/xslt/docbook/common/db-common.xsl b/xslt/docbook/common/db-common.xsl
index 8819e66..900da4e 100644
--- a/xslt/docbook/common/db-common.xsl
+++ b/xslt/docbook/common/db-common.xsl
@@ -41,6 +41,73 @@ attribute in DocBook 5.
 <xsl:key name="db.id.key" match="*" use="@id | @xml:id"/>
 
 
+<!--++==========================================================================
+db.biblio.abbrev.key
+Get a #{biblioentry} or #{bibliomixed} element from its #{abbrev}.
+:Revision:version="3.18" date="2015-07-23" status="final"
+
+This key returns #{biblioentry} and #{bibliomixed} elements based on their child
+#{abbrev} elements. The #{abbrev} element must be the first child element of the
+#{biblioentry} or #{bibliomixed} element. This key only returns elements that
+have an #{id} attribute for DocBook 4 or an #{xml:id} attribute for DocBook 5.
+-->
+<xsl:key name="db.biblio.abbrev.key"
+         match="biblioentry[ id and *[1]/self::abbrev] |
+                bibliomixed[ id and *[1]/self::abbrev] |
+                db:biblioentry[ xml:id and *[1]/self::db:abbrev] |
+                db:bibliomixed[ xml:id and *[1]/self::db:abbrev]"
+         use="string(*[1])"/>
+
+
+<!--++==========================================================================
+db.biblio.label.key
+Get a #{biblioentry} or #{bibliomixed} element from its #{xreflabel}.
+:Revision:version="3.18" date="2015-07-23" status="final"
+
+This key returns #{biblioentry} and #{bibliomixed} elements based on their
+#{xreflabel} attributes. It only returns elements that have an #{id} attribute
+for DocBook 4 or an #{xml:id} attribute for DocBook 5.
+-->
+<xsl:key name="db.biblio.label.key"
+         match="biblioentry[ id and @xreflabel] |
+                bibliomixed[ id and @xreflabel] |
+                db:biblioentry[ xml:id and @xreflabel] |
+                db:bibliomixed[ xml:id and @xreflabel]"
+         use="string(@xreflabel)"/>
+
+
+<!--++==========================================================================
+db.biblio.id.key
+Get a #{biblioentry} or #{bibliomixed} element from its #{id}.
+:Revision:version="3.18" date="2015-07-23" status="final"
+
+This key returns #{biblioentry} and #{bibliomixed} elements based on their #{id}
+or #{xml:id} attributes. The {#id} attribute is used for DocBook 4, and the
+#{xml:id} attribute is used for DocBook 5.
+-->
+<xsl:key name="db.biblio.id.key"
+         match="biblioentry[ id] | bibliomixed[ id]"
+         use="string(@id)"/>
+<xsl:key name="db.biblio.id.key"
+         match="db:biblioentry[ xml:id] | db:bibliomixed[ xml:id]"
+         use="string(@xml:id)"/>
+
+
+<!--++==========================================================================
+db.glossentry.key
+Get a #{glossentry} element from its #{glossterm}.
+:Revision:version="3.18" date="2015-07-22" status="final"
+
+This key returns #{glossentry} elements based on the text in their #{glossterm}
+child elements. It only returns #{glossentry} elements that have an #{id}
+attribute in DocBook 4 or an #{xml:id} attribute in DocBook 5.
+-->
+<xsl:key name="db.glossentry.key"
+         match="glossentry[ id]" use="string(glossterm)"/>
+<xsl:key name="db.glossentry.key"
+         match="db:glossentry[ xml:id]" use="string(db:glossterm)"/>
+
+
 <!--**==========================================================================
 db.copyright
 Outputs copyright information
diff --git a/xslt/docbook/html/db2html-division.xsl b/xslt/docbook/html/db2html-division.xsl
index 3cd5370..7c7484a 100644
--- a/xslt/docbook/html/db2html-division.xsl
+++ b/xslt/docbook/html/db2html-division.xsl
@@ -197,7 +197,7 @@ REMARK: Talk about some of the parameters
       </xsl:call-template>
     </xsl:if>
     <xsl:for-each select="$divisions">
-      <xsl:if test="not($chunk_divisions) or not(contains($db.chunk.chunks_, local-name(.)))">
+      <xsl:if test="not($chunk_divisions) or not(contains($db.chunk.chunks, local-name(.)))">
         <xsl:apply-templates select=".">
           <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk + 1"/>
           <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
diff --git a/xslt/docbook/html/db2html-inline.xsl b/xslt/docbook/html/db2html-inline.xsl
index 1a9da57..45085c7 100644
--- a/xslt/docbook/html/db2html-inline.xsl
+++ b/xslt/docbook/html/db2html-inline.xsl
@@ -176,31 +176,6 @@ FIXME
   <xsl:call-template name="db2html.inline"/>
 </xsl:template>
 
-<!-- = bibkey-abbrev = -->
-<xsl:key name="bibkey-abbrev"
-         match="biblioentry[ id and *[1]/self::abbrev] |
-                bibliomixed[ id and *[1]/self::abbrev] |
-                db:biblioentry[ xml:id and *[1]/self::db:abbrev] |
-                db:bibliomixed[ xml:id and *[1]/self::db:abbrev]"
-         use="string(*[1])"/>
-
-<!-- = bibkey-label = -->
-<xsl:key name="bibkey-label"
-         match="biblioentry[ id and @xreflabel] |
-                bibliomixed[ id and @xreflabel] |
-                db:biblioentry[ xml:id and @xreflabel] |
-                db:bibliomixed[ xml:id and @xreflabel]"
-         use="string(@xreflabel)"/>
-
-<!-- = bibkey-id = -->
-<xsl:key name="bibkey-id"
-         match="biblioentry[ id] | bibliomixed[ id]"
-         use="string(@id)"/>
-
-<xsl:key name="bibkey-id"
-         match="db:biblioentry[ xml:id] | db:bibliomixed[ xml:id]"
-         use="string(@xml:id)"/>
-
 <!-- = biblioid = -->
 <xsl:template match="db:biblioid">
   <xsl:call-template name="db2html.inline"/>
@@ -224,7 +199,8 @@ FIXME
 <xsl:template mode="l10n.format.mode" match="msg:citation.label">
   <xsl:param name="node"/>
   <xsl:for-each select="$node[1]">
-    <xsl:variable name="entry_abbrev" select="key('bibkey-abbrev', string($node))"/>
+    <xsl:variable name="entry_abbrev"
+                  select="key('db.biblio.abbrev.key', string($node))"/>
     <xsl:choose>
       <xsl:when test="$entry_abbrev">
         <xsl:call-template name="db2html.xref">
@@ -236,7 +212,8 @@ FIXME
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:variable name="entry_label" select="key('bibkey-label', string($node))"/>
+        <xsl:variable name="entry_label"
+                      select="key('db.biblio.label.key', string($node))"/>
         <xsl:choose>
           <xsl:when test="$entry_label">
             <xsl:call-template name="db2html.xref">
@@ -248,7 +225,8 @@ FIXME
             </xsl:call-template>
           </xsl:when>
           <xsl:otherwise>
-            <xsl:variable name="entry_id" select="key('bibkey-id', string($node))"/>
+            <xsl:variable name="entry_id"
+                          select="key('db.biblio.id.key', string($node))"/>
             <xsl:choose>
               <xsl:when test="$entry_id">
                 <xsl:call-template name="db2html.xref">
@@ -512,10 +490,6 @@ FIXME
   </xsl:call-template>
 </xsl:template>
 
-<!-- = glosskey = -->
-<xsl:key name="glosskey" match="glossentry[ id]" use="string(glossterm)"/>
-<xsl:key name="glosskey" match="db:glossentry[ xml:id]" use="string(db:glossterm)"/>
-
 <!-- = glossterm = -->
 <xsl:template match="glossterm | db:glossterm">
   <xsl:call-template name="db2html.inline"/>
@@ -533,7 +507,7 @@ FIXME
       </xsl:call-template>
     </xsl:when>
     <xsl:when test="not(../self::glossentry) and not(../self::db:glossentry)">
-      <xsl:variable name="glossentry" select="key('glosskey', string(.))"/>
+      <xsl:variable name="glossentry" select="key('db.glossentry.key', string(.))"/>
       <xsl:choose>
         <xsl:when test="$glossentry">
           <xsl:call-template name="db2html.xref">
diff --git a/xslt/mallard/common/mal-gloss.xsl b/xslt/mallard/common/mal-gloss.xsl
index ebd9a4b..d0dbf0f 100644
--- a/xslt/mallard/common/mal-gloss.xsl
+++ b/xslt/mallard/common/mal-gloss.xsl
@@ -32,6 +32,14 @@ with the Mallard Glossary extension.
 -->
 
 
+<!--++==========================================================================
+mal.gloss.key
+Get a #{gloss:term} element from its #{id} attribute.
+
+This key returns #{gloss:term} elements based on their #{id} attribute. This
+key only applies to elements inside a cache file. Make sure to make the cache
+file the context document before calling this key.
+-->
 <xsl:key name="mal.gloss.key"
          match="/cache:cache//mal:info/gloss:term[ id]"
          use="@id"/>
diff --git a/xslt/mallard/common/mal-link.xsl b/xslt/mallard/common/mal-link.xsl
index 5fb3aec..41b2ab0 100644
--- a/xslt/mallard/common/mal-link.xsl
+++ b/xslt/mallard/common/mal-link.xsl
@@ -94,8 +94,13 @@ The context node must be in the document @{mal.cache} when this key is called.
          use="concat(@type, ':', @xref)"/>
 
 
-<!--============================================================================
+<!--++==========================================================================
 mal.facet.all.key
+Get all #{page} and #{section} elements with #{facet:tag} elements.
+
+This key returns all #{page} and #{section} elements that have at least one
+#{facet:tag} element in their #{info} element. Pass the emptry string as the
+key argument.
 -->
 <xsl:key name="mal.facet.all.key"
          match="mal:page[mal:info/facet:tag] | mal:section[mal:info/facet:tag]"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]