[gtk-doc] xslt: cache some nodesets to be quicker



commit cb1f9ef3e2bafc0df64117bafd64b716575c0bd5
Author: Stefan Kost <ensonic users sf net>
Date:   Thu Jan 7 14:37:22 2010 +0200

    xslt: cache some nodesets to be quicker

 devhelp.xsl  |    2 +-
 devhelp2.xsl |    4 ++--
 gtk-doc.xsl  |   23 ++++++++++++++---------
 3 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/devhelp.xsl b/devhelp.xsl
index a889002..b2364fc 100644
--- a/devhelp.xsl
+++ b/devhelp.xsl
@@ -52,7 +52,7 @@
         </chapters>
       </xsl:if>
       <functions>
-        <xsl:apply-templates select="//refsect2"
+        <xsl:apply-templates select="$gtkdoc.refsect2"
                              mode="generate.devhelp.index.mode"/>
       </functions>
     </book>
diff --git a/devhelp2.xsl b/devhelp2.xsl
index 930cc8a..b183e9a 100644
--- a/devhelp2.xsl
+++ b/devhelp2.xsl
@@ -53,9 +53,9 @@
         </chapters>
       </xsl:if>
       <functions>
-        <xsl:apply-templates select="//refsect2"
+        <xsl:apply-templates select="$gtkdoc.refsect2"
                              mode="generate.devhelp2.index.mode"/>
-        <xsl:apply-templates select="//refsect2/variablelist[ role='enum']/varlistentry"
+        <xsl:apply-templates select="$gtkdoc.refsect2/variablelist[ role='enum']/varlistentry"
                              mode="generate.devhelp2.index.mode"/>
       </functions>
     </book>
diff --git a/gtk-doc.xsl b/gtk-doc.xsl
index 5f2e343..983d3f3 100644
--- a/gtk-doc.xsl
+++ b/gtk-doc.xsl
@@ -139,6 +139,8 @@
   <!-- ========================================================= -->
   <!-- template to create the index.sgml anchor index -->
 
+  <xsl:param name="gtkdoc.refsect2" select="//refsect2" />
+
   <xsl:template match="book|article">
     <xsl:variable name="tooldver">
       <xsl:call-template name="version-greater-or-equal">
@@ -157,6 +159,7 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
 
     <!-- generate the index.sgml href index -->
     <xsl:call-template name="generate.index"/>
+    <!-- generate $book.devhelp{2} -->
     <xsl:call-template name="generate.devhelp"/>
     <xsl:call-template name="generate.devhelp2"/>
   </xsl:template>
@@ -168,7 +171,7 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
         <xsl:apply-templates select="/book/bookinforeleaseinfo/ulink"
                              mode="generate.index.mode"/>
         <!-- check all anchor and refentry elements -->
-        <xsl:apply-templates select="//anchor|//refentry|//refsect1|//refsect2|//refsynopsisdiv|//varlistentry"
+        <xsl:apply-templates select="//anchor|//refentry|//refsect1|$gtkdoc.refsect2|//refsynopsisdiv|//varlistentry"
                              mode="generate.index.mode"/>
       </xsl:with-param>
       <xsl:with-param name="default.encoding" select="'UTF-8'"/>
@@ -228,6 +231,15 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
     <xsl:apply-imports/>
   </xsl:template>
 
+  <xsl:param name="gtkdoc.linknodes" select="//part
+                          |//reference
+                          |//preface
+                          |//chapter
+                          |//article
+                          |//appendix[not(parent::article)]|appendix
+                          |//glossary[not(parent::article)]|glossary
+                          |//index[not(parent::article)]|index"/>
+
   <xsl:template name="user.head.content">
     <xsl:if test="$gtkdoc.version">
       <meta name="generator" content="GTK-Doc V{$gtkdoc.version} (XML mode)"/>
@@ -238,14 +250,7 @@ Get a newer version at http://docbook.sourceforge.net/projects/xsl/
          we don't want links for all refentrys, thats just too much
       -->
     <xsl:variable name="this" select="."/>
-    <xsl:for-each select="//part
-                          |//reference
-                          |//preface
-                          |//chapter
-                          |//article
-                          |//appendix[not(parent::article)]|appendix
-                          |//glossary[not(parent::article)]|glossary
-                          |//index[not(parent::article)]|index">
+    <xsl:for-each select="$gtkdoc.linknodes">
       <link rel="{local-name(.)}">
         <xsl:attribute name="href">
           <xsl:call-template name="href.target">



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