[yelp-xsl] docbook: Added support for conditional processing



commit 81cc4bf5257cda1c3e43d4339d96147029e33259
Author: Shaun McCance <shaunm gnome org>
Date:   Mon Aug 12 23:56:59 2013 -0400

    docbook: Added support for conditional processing

 xslt/docbook/common/Makefile.am             |    1 +
 xslt/docbook/common/db-common.xsl           |   56 ++++-
 xslt/docbook/common/db-profile.xsl          |  323 +++++++++++++++++++++++++++
 xslt/docbook/html/db2html-bibliography.xsl  |   11 +-
 xslt/docbook/html/db2html-block.xsl         |   58 +++++-
 xslt/docbook/html/db2html-callout.xsl       |    8 +-
 xslt/docbook/html/db2html-classsynopsis.xsl |    3 +
 xslt/docbook/html/db2html-cmdsynopsis.xsl   |    3 +
 xslt/docbook/html/db2html-index.xsl         |    3 +
 xslt/docbook/html/db2html-inline.xsl        |   16 ++-
 xslt/docbook/html/db2html-list.xsl          |  145 ++++++++----
 xslt/docbook/html/db2html-media.xsl         |   84 ++++++--
 xslt/docbook/html/db2html-refentry.xsl      |    3 +
 xslt/docbook/html/db2html-table.xsl         |    3 +
 xslt/docbook/html/db2html.xsl               |    6 +-
 xslt/docbook/html/db2xhtml.xsl              |    2 +
 16 files changed, 637 insertions(+), 88 deletions(-)
---
diff --git a/xslt/docbook/common/Makefile.am b/xslt/docbook/common/Makefile.am
index 3442520..5ffb89c 100644
--- a/xslt/docbook/common/Makefile.am
+++ b/xslt/docbook/common/Makefile.am
@@ -8,6 +8,7 @@ xsldir=$(datadir)/yelp-xsl/xslt/docbook/common
 xsl_DATA =                     \
        db-chunk.xsl            \
        db-common.xsl           \
+       db-profile.xsl          \
        db-title.xsl            \
        db-xref.xsl
 
diff --git a/xslt/docbook/common/db-common.xsl b/xslt/docbook/common/db-common.xsl
index 1d76480..1039828 100644
--- a/xslt/docbook/common/db-common.xsl
+++ b/xslt/docbook/common/db-common.xsl
@@ -126,32 +126,64 @@ of the same name, counts its lines, and handles any #{startinglinenumber} or
 
 <!--**==========================================================================
 db.orderedlist.start
-Determines the number to use for the first #{listitem} in an #{orderedlist}
-$node: The #{orderedlist} element to use
+Determine the number to use for the first #{listitem} in an #{orderedlist}.
+:Revision:version="3.10" date="2013-08-12" status="final"
+$node: The #{orderedlist} element to use.
+$continuation: The value of the #{continuation} attribute.
 
 This template determines the starting number for an #{orderedlist} element using
-the #{continuation} attribute.  Thi template finds the first preceding #{orderedlist}
-element and counts its list items.  If that element also uses the #{continuation},
-this template calls itself recursively to add that element's starting line number
-to its list item count.
+the #{continuation} attribute.  The template finds the first preceding #{orderedlist}
+element and counts its list items.  If that element also uses the #{continuation}
+attribute, this template calls itself recursively to add that element's starting
+line number to its list item count.
+
+This template uses conditional processing when looking at preceding ordered lists
+and their child list items.
+
+The ${continuation} parameter is automatically set based on the #{continuation}
+attribute of ${node}. It exists as a parameter to allow this template to force
+continuation when it calls itself recursively for conditional processing.
 -->
 <xsl:template name="db.orderedlist.start">
   <xsl:param name="node" select="."/>
+  <xsl:param name="continuation" select="$node/@continuation"/>
   <xsl:choose>
-    <xsl:when test="$node/@continutation != 'continues'">1</xsl:when>
+    <xsl:when test="$continuation != 'continues'">1</xsl:when>
     <xsl:otherwise>
       <xsl:variable name="prevlist"
-                    select="$node/preceding::orderedlist[1]"/>
+                    select="($node/preceding::orderedlist[1] | $node/preceding::db:orderedlist[1])[last()]"/>
       <xsl:choose>
         <xsl:when test="count($prevlist) = 0">1</xsl:when>
         <xsl:otherwise>
-          <xsl:variable name="prevlength" select="count($prevlist/listitem)"/>
-          <xsl:variable name="prevstart">
-            <xsl:call-template name="db.orderedlist.start">
+          <xsl:variable name="prevlistif">
+            <xsl:call-template name="db.profile.test">
               <xsl:with-param name="node" select="$prevlist"/>
             </xsl:call-template>
           </xsl:variable>
-          <xsl:value-of select="$prevstart + $prevlength"/>
+          <xsl:choose>
+            <xsl:when test="$prevlistif = ''">
+              <xsl:call-template name="db.orderedlist.start">
+                <xsl:with-param name="node" select="$prevlist"/>
+                <xsl:with-param name="continuation" select="'continues'"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:variable name="prevlength">
+                <xsl:for-each select="$prevlist/listitem | $prevlist/db:listitem">
+                  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+                  <xsl:if test="$if != ''">
+                    <xsl:text>x</xsl:text>
+                  </xsl:if>
+                </xsl:for-each>
+              </xsl:variable>
+              <xsl:variable name="prevstart">
+                <xsl:call-template name="db.orderedlist.start">
+                  <xsl:with-param name="node" select="$prevlist"/>
+                </xsl:call-template>
+              </xsl:variable>
+              <xsl:value-of select="$prevstart + string-length($prevlength)"/>
+            </xsl:otherwise>
+          </xsl:choose>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:otherwise>
diff --git a/xslt/docbook/common/db-profile.xsl b/xslt/docbook/common/db-profile.xsl
new file mode 100644
index 0000000..7a98103
--- /dev/null
+++ b/xslt/docbook/common/db-profile.xsl
@@ -0,0 +1,323 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
+<!--
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; see the file COPYING.LGPL.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+                xmlns:str="http://exslt.org/strings";
+                exclude-result-prefixes="str"
+                version="1.0">
+
+<!--!!==========================================================================
+DocBook Profiling
+Support for DocBook effectivity attributes
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This stylesheet contains utilities for handling conditional processing
+in DocBook documents.
+-->
+
+
+<!--@@==========================================================================
+db.profile.arch
+The list of architectures for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{arch} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.arch" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.audience
+The list of audiences for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{audience} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.audience" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.condition
+The list of application-specific conditions for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{condition} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.condition" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.conformance
+The list of conformance characteristics for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{conformance} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.conformance" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.os
+The list of operating systems for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{os} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.os" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.outputformat
+The list of output formats for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{outputformat} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.os" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.revision
+The list of editorial revisions for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{revision} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.revision" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.security
+The list of security levels for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{security} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.security" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.userlevel
+The list of user experience levels for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{userlevel} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.userlevel" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.vendor
+The list of vendors for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{vendor} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.vendor" select="''"/>
+
+
+<!--@@==========================================================================
+db.profile.wordsize
+The list of word sizes for conditional processing.
+:Revision:version="3.10" date="2013-08-12" status="final"
+
+This parameter takes a semicolon-separated list of values to match against the
+#{wordsize} attribute for conditional processing.
+-->
+<xsl:param name="db.profile.wordsize" select="''"/>
+
+
+<!--**==========================================================================
+db.profile.test
+Test if an element should be shown based on profiling attributes.
+:Revision:version="3.10" date="2013-08-12" status="final"
+$node: The element to check the condition for.
+
+This template looks at all the profiling attributes of the element ${node}:
+#{arch}, #{audience}, #{condition}, #{conformance}, #{os}, #{outputformat},
+#{revision}, #{security}, #{userlevel}, #{vendor}, and #{wordsize}. It returns
+the string #{"true"} if all attributes present match the corresponding parameter
+in this stylesheet. Attributes and parameters can both be lists, separated by
+semicolons. An attribute matches a parameter if there is at least one value in
+common between the two.
+-->
+<xsl:template name="db.profile.test">
+  <xsl:param name="node" select="."/>
+
+  <xsl:variable name="testnot">
+    <xsl:if test="$node/@arch != '' and $db.profile.arch != ''">
+      <xsl:variable name="testarch">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@arch"/>
+          <xsl:with-param name="value" select="$db.profile.arch"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testarch = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@audience != '' and $db.profile.audience != ''">
+      <xsl:variable name="testaudience">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@audience"/>
+          <xsl:with-param name="value" select="$db.profile.audience"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testaudience = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@condition != '' and $db.profile.condition != ''">
+      <xsl:variable name="testcondition">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@condition"/>
+          <xsl:with-param name="value" select="$db.profile.condition"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testcondition = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@conformance != '' and $db.profile.conformance != ''">
+      <xsl:variable name="testconformance">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@conformance"/>
+          <xsl:with-param name="value" select="$db.profile.conformance"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testconformance = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@os != '' and $db.profile.os != ''">
+      <xsl:variable name="testos">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@os"/>
+          <xsl:with-param name="value" select="$db.profile.os"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testos = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@outputformat != '' and $db.profile.outputformat != ''">
+      <xsl:variable name="testoutputformat">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@outputformat"/>
+          <xsl:with-param name="value" select="$db.profile.outputformat"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testoutputformat = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@revision != '' and $db.profile.revision != ''">
+      <xsl:variable name="testrevision">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@revision"/>
+          <xsl:with-param name="value" select="$db.profile.revision"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testrevision = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@security != '' and $db.profile.security != ''">
+      <xsl:variable name="testsecurity">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@security"/>
+          <xsl:with-param name="value" select="$db.profile.security"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testsecurity = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@userlevel != '' and $db.profile.userlevel != ''">
+      <xsl:variable name="testuserlevel">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@userlevel"/>
+          <xsl:with-param name="value" select="$db.profile.userlevel"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testuserlevel = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@vendor != '' and $db.profile.vendor != ''">
+      <xsl:variable name="testvendor">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@vendor"/>
+          <xsl:with-param name="value" select="$db.profile.vendor"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testvendor = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="$node/@wordsize != '' and $db.profile.wordsize != ''">
+      <xsl:variable name="testwordsize">
+        <xsl:call-template name="_db.profile.test.compare">
+          <xsl:with-param name="attr" select="$node/@wordsize"/>
+          <xsl:with-param name="value" select="$db.profile.wordsize"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="$testwordsize = ''">
+        <xsl:text>x</xsl:text>
+      </xsl:if>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:if test="$testnot = ''">
+    <xsl:text>true</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<!--#* _db.profile.test.compare -->
+<xsl:template name="_db.profile.test.compare">
+  <xsl:param name="attr"/>
+  <xsl:param name="value"/>
+  <xsl:variable name="attr_" select="concat(';', $attr, ';')"/>
+  <xsl:for-each select="str:split($value, ';')">
+    <xsl:if test="contains($attr_, concat(';', ., ';'))">
+      <xsl:text>1</xsl:text>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/docbook/html/db2html-bibliography.xsl b/xslt/docbook/html/db2html-bibliography.xsl
index d8cb0f0..8d6e8ea 100644
--- a/xslt/docbook/html/db2html-bibliography.xsl
+++ b/xslt/docbook/html/db2html-bibliography.xsl
@@ -185,11 +185,6 @@ inside a bibliography entry.
 <!-- = affiliation % db2html.biblioentry.mode = -->
 <xsl:template mode="db2html.biblioentry.mode" match="affiliation | db:affiliation"/>
 
-<!-- = annotation % db2html.biblioentry.mode = -->
-<xsl:template mode="db2html.biblioentry.mode" match="db:annotation">
-  <xsl:apply-templates select="."/>
-</xsl:template>
-
 <!-- = author % db2html.biblioentry.mode = -->
 <xsl:template mode="db2html.biblioentry.mode" match="author | db:author">
   <xsl:call-template name="db.personname"/>
@@ -335,6 +330,8 @@ inside a bibliography entry.
 
 <!-- = biblioentry = -->
 <xsl:template match="biblioentry | db:biblioentry">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'biblioentry'"/>
@@ -344,11 +341,14 @@ inside a bibliography entry.
     <xsl:call-template name="db2html.biblioentry.label"/>
     <xsl:call-template name="db2html.biblioentry.data"/>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = bibliomixed = -->
 <xsl:template match="bibliomixed | db:bibliomixed">
   <xsl:variable name="node" select="."/>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'biblimixed'"/>
@@ -359,6 +359,7 @@ inside a bibliography entry.
     <xsl:apply-templates mode="db2html.biblioentry.mode"
                          select="node()[not(set:has-same-node(., $node/*[1]/self::abbrev | 
$node/*[1]/self::db:abbrev))]"/>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = bibliolist = -->
diff --git a/xslt/docbook/html/db2html-block.xsl b/xslt/docbook/html/db2html-block.xsl
index 34155a9..ad21f49 100644
--- a/xslt/docbook/html/db2html-block.xsl
+++ b/xslt/docbook/html/db2html-block.xsl
@@ -37,17 +37,25 @@ complex block-level elements.
 <!--**==========================================================================
 db2html.block
 Output an HTML #{div} element for a block-level element.
-:Revision:version="3.10" date="2011-07-11" status="final"
+:Revision:version="3.10" date="2013-08-09" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 
 This template creates an HTML #{div} element for the given DocBook element.
 It passes the ${class} parameter to *{html.class.attr}.
 If the ${class} parameter is not provided, it uses the local name of ${node}.
+
+This template handles conditional processing.
 -->
 <xsl:template name="db2html.block">
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="local-name($node)"/>
+  <xsl:variable name="if">
+    <xsl:call-template name="db.profile.test">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="node" select="$node"/>
@@ -61,13 +69,14 @@ If the ${class} parameter is not provided, it uses the local name of ${node}.
     </xsl:call-template>
     <xsl:apply-templates select="$node/node()"/>
   </div>
+  </xsl:if>
 </xsl:template>
 
 
 <!--**==========================================================================
 db2html.block.formal
 Output HTML for a block-level element with an optional title and caption.
-:Revision:version="3.10" date="2011-07-11" status="final"
+:Revision:version="3.10" date="2013-08-09" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 $title: An element to use for the title.
@@ -81,6 +90,8 @@ local name of ${node}. Even if ${title} and ${caption} are both empty, this
 template still outputs the extra wrapper elements for formal elements. If
 ${titleattr} is provided, it is used for the value of the HTML #{title}
 attribute on the outermost #{div} element.
+
+This template handles conditional processing.
 -->
 <xsl:template name="db2html.block.formal">
   <xsl:param name="node" select="."/>
@@ -90,6 +101,12 @@ attribute on the outermost #{div} element.
   <xsl:param name="caption" select="$node/caption | $node/db:caption"/>
   <xsl:param name="titleattr" select="''"/>
 
+  <xsl:variable name="if">
+    <xsl:call-template name="db.profile.test">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="node" select="$node"/>
@@ -135,6 +152,7 @@ attribute on the outermost #{div} element.
       </div>
     </div>
   </div>
+  </xsl:if>
 </xsl:template>
 
 
@@ -189,14 +207,22 @@ element.  It is called by *{db2html.block.formal}.
 <!--**==========================================================================
 db2html.blockquote
 Output an HTML #{blockquote} element.
-:Revision:version="3.10" date="2011-07-11" status="final"
+:Revision:version="3.10" date="2013-08-09" status="final"
 $node: The DocBook element ot render as a quote.
 
 This template creates an HTML #{blockquote} element for the given DocBook
 element. It's used for the DocBook #{blockquote} and #{epigraph} elements.
+
+This template handles conditional processing.
 -->
 <xsl:template name="db2html.blockquote">
   <xsl:param name="node" select="."/>
+  <xsl:variable name="if">
+    <xsl:call-template name="db.profile.test">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="node" select="$node"/>
@@ -223,23 +249,32 @@ element. It's used for the DocBook #{blockquote} and #{epigraph} elements.
       </div>
     </div>
   </div>
+  </xsl:if>
 </xsl:template>
 
 
 <!--**==========================================================================
 db2html.para
 Output an HTML #{p} element for a block-level element.
-:Revision:version="3.10" date="2011-07-11" status="final"
+:Revision:version="3.10" date="2013-08-09" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 
 This template creates an HTML #{p} element for the given DocBook element.
 It passes the ${class} parameter to *{html.class.attr}.
 If the ${class} parameter is not provided, it uses the local name of ${node}.
+
+This template handles conditional processing.
 -->
 <xsl:template name="db2html.para">
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="local-name($node)"/>
+  <xsl:variable name="if">
+    <xsl:call-template name="db.profile.test">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:if test="$if != ''">
   <p>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="node" select="$node"/>
@@ -253,13 +288,14 @@ If the ${class} parameter is not provided, it uses the local name of ${node}.
     </xsl:call-template>
     <xsl:apply-templates select="$node/node()"/>
   </p>
+  </xsl:if>
 </xsl:template>
 
 
 <!--**==========================================================================
 db2html.pre
 Output an HTML #{pre} element for a block-level element.
-:Revision:version="3.10" date="2011-07-11" status="final"
+:Revision:version="3.10" date="2013-08-09" status="final"
 $node: The block-level element to render.
 $class: The value of the HTML #{class} attribute.
 $children: The child elements to process.
@@ -277,11 +313,19 @@ nodes in the ${children} parameter to override this behavior.
 
 If @{html.syntax.highlight} is #{true}, this template automatically outputs
 syntax highlighting support based on the #{language} attribute of ${node}.
+
+This template handles conditional processing.
 -->
 <xsl:template name="db2html.pre">
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="local-name($node)"/>
   <xsl:param name="children" select="$node/node()"/>
+  <xsl:variable name="if">
+    <xsl:call-template name="db.profile.test">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="node" select="$node"/>
@@ -385,6 +429,7 @@ syntax highlighting support based on the #{language} attribute of ${node}.
       <xsl:apply-templates select="$children[not(position() = 1 and self::text())]"/>
     </pre>
   </div>
+  </xsl:if>
 </xsl:template>
 
 
@@ -427,6 +472,8 @@ syntax highlighting support based on the #{language} attribute of ${node}.
   <xsl:param name="depth_in_chunk">
     <xsl:call-template name="db.chunk.depth-in-chunk"/>
   </xsl:param>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <xsl:variable name="render">
     <xsl:choose>
       <xsl:when test="starts-with(@renderas, 'sect')">
@@ -456,6 +503,7 @@ syntax highlighting support based on the #{language} attribute of ${node}.
       <xsl:apply-templates/>
     </xsl:element>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = caption = -->
diff --git a/xslt/docbook/html/db2html-callout.xsl b/xslt/docbook/html/db2html-callout.xsl
index 160438b..913ed83 100644
--- a/xslt/docbook/html/db2html-callout.xsl
+++ b/xslt/docbook/html/db2html-callout.xsl
@@ -57,7 +57,10 @@ element, locate the corresponding #{co} element and call this template on it.
 
 <!-- = co = -->
 <xsl:template match="co | db:co">
-  <xsl:call-template name="db2html.callout.label"/>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
+    <xsl:call-template name="db2html.callout.label"/>
+  </xsl:if>
 </xsl:template>
 
 <!-- = calloutlist = -->
@@ -68,6 +71,8 @@ element, locate the corresponding #{co} element and call this template on it.
 <!-- = callout == -->
 <xsl:template match="callout | db:callout">
   <xsl:variable name="node" select="."/>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'callout'"/>
@@ -89,6 +94,7 @@ element, locate the corresponding #{co} element and call this template on it.
     </div>
     <xsl:apply-templates/>
   </div>
+  </xsl:if>
 </xsl:template>
 
 </xsl:stylesheet>
diff --git a/xslt/docbook/html/db2html-classsynopsis.xsl b/xslt/docbook/html/db2html-classsynopsis.xsl
index b9d9a0d..5d882ed 100644
--- a/xslt/docbook/html/db2html-classsynopsis.xsl
+++ b/xslt/docbook/html/db2html-classsynopsis.xsl
@@ -68,6 +68,8 @@ at the root of a DocBook document.
               methodsynopsis    | destructorsynopsis     |
               db:classsynopsis  | db:constructorsynopsis | db:fieldsynopsis |
               db:methodsynopsis | db:destructorsynopsis  |">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <xsl:variable name="language">
     <xsl:choose>
       <xsl:when test="@language">
@@ -105,6 +107,7 @@ at the root of a DocBook document.
       </xsl:choose>
     </pre>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = classsynopsisinfo = -->
diff --git a/xslt/docbook/html/db2html-cmdsynopsis.xsl b/xslt/docbook/html/db2html-cmdsynopsis.xsl
index 462738c..1124087 100644
--- a/xslt/docbook/html/db2html-cmdsynopsis.xsl
+++ b/xslt/docbook/html/db2html-cmdsynopsis.xsl
@@ -132,6 +132,8 @@ This module contains templates to process DocBook command synopsis elements.
       </xsl:otherwise>
     </xsl:choose>
   </xsl:param>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'synopsis cmdsynopsis'"/>
@@ -167,6 +169,7 @@ This module contains templates to process DocBook command synopsis elements.
       </xsl:apply-templates>
     </pre>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = group = -->
diff --git a/xslt/docbook/html/db2html-index.xsl b/xslt/docbook/html/db2html-index.xsl
index 6394dd6..b4cbc3c 100644
--- a/xslt/docbook/html/db2html-index.xsl
+++ b/xslt/docbook/html/db2html-index.xsl
@@ -47,6 +47,8 @@ indexterm (autoidx)
 
 <!-- = indexentry = -->
 <xsl:template match="indexentry | db:indexentry">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <dt class="primaryie">
     <xsl:apply-templates select="primaryie/node() | db:primaryie/node()"/>
   </dt>
@@ -119,6 +121,7 @@ indexterm (autoidx)
       </dl>
     </dd>
   </xsl:for-each>
+  </xsl:if>
 </xsl:template>
 
 <!-- = index = -->
diff --git a/xslt/docbook/html/db2html-inline.xsl b/xslt/docbook/html/db2html-inline.xsl
index 68dfe61..7697551 100644
--- a/xslt/docbook/html/db2html-inline.xsl
+++ b/xslt/docbook/html/db2html-inline.xsl
@@ -65,6 +65,8 @@ $lang: The locale of the text in ${node}
 $name-class: The class to use for the name of the element
 
 REMARK: Document this template
+
+This template handles conditional processing.
 -->
 <xsl:template name="db2html.inline">
   <xsl:param name="node" select="."/>
@@ -75,7 +77,12 @@ REMARK: Document this template
   <xsl:variable name="xlink" select="$node/@xl:href"/>
   <xsl:variable name="linkend" select="$node/@linkend"/>
 
-  <!-- FIXME: do CSS classes, rather than inline styles -->
+  <xsl:variable name="if">
+    <xsl:call-template name="db.profile.test">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:if test="$if != ''">
   <span>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="node" select="$node"/>
@@ -107,6 +114,7 @@ REMARK: Document this template
       </xsl:otherwise>
     </xsl:choose>
   </span>
+  </xsl:if>
 </xsl:template>
 
 
@@ -1178,18 +1186,24 @@ FIXME
 
 <!-- = subscript = -->
 <xsl:template match="subscript | db:subscript">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <sub class="subscript">
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates/>
   </sub>
+  </xsl:if>
 </xsl:template>
 
 <!-- = superscript = -->
 <xsl:template match="superscript | db:superscript">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <sup class="superscript">
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates/>
   </sup>
+  </xsl:if>
 </xsl:template>
 
 <!-- = surname = -->
diff --git a/xslt/docbook/html/db2html-list.xsl b/xslt/docbook/html/db2html-list.xsl
index 8680564..2de5ad6 100644
--- a/xslt/docbook/html/db2html-list.xsl
+++ b/xslt/docbook/html/db2html-list.xsl
@@ -19,8 +19,9 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 xmlns:db="http://docbook.org/ns/docbook";
                 xmlns:msg="http://projects.gnome.org/yelp/gettext/";
+                xmlns:str="http://exslt.org/strings";
                 xmlns="http://www.w3.org/1999/xhtml";
-                exclude-result-prefixes="db msg"
+                exclude-result-prefixes="db msg str"
                 version="1.0">
 
 <!--!!==========================================================================
@@ -35,6 +36,8 @@ REMARK: Describe this module
 
 <!-- = glosslist = -->
 <xsl:template match="glosslist | db:glosslist">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'list glosslist'"/>
@@ -46,10 +49,13 @@ REMARK: Describe this module
       <xsl:apply-templates select="glossentry | db:glossentry"/>
     </dl>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = glossdef = -->
 <xsl:template match="glossdef | db:glossdef">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <dd>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'glossdef'"/>
@@ -57,10 +63,13 @@ REMARK: Describe this module
     <xsl:apply-templates select="*[not(self::glossseealso) and not(self::db:glossseealso)]"/>
   </dd>
   <xsl:apply-templates select="glossseealso[1] | db:glossseealso[1]"/>
+  </xsl:if>
 </xsl:template>
 
 <!-- = glossentry = -->
 <xsl:template match="glossentry | db:glossentry">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <dt>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'glossterm'"/>
@@ -75,10 +84,13 @@ REMARK: Describe this module
     </xsl:if>
   </dt>
   <xsl:apply-templates select="glossdef | glosssee[1] | db:glossdef | db:glosssee[1]"/>
+  </xsl:if>
 </xsl:template>
 
 <!-- = glosssee(also) = -->
 <xsl:template match="glosssee | glossseealso | db:glosssee | db:glossseealso">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <dd>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="local-name(.)"/>
@@ -91,6 +103,7 @@ REMARK: Describe this module
       </xsl:call-template>
     </p>
   </dd>
+  </xsl:if>
 </xsl:template>
 
 <!--#% l10n.format.mode -->
@@ -138,6 +151,8 @@ REMARK: Describe this module
 
 <!-- = itemizedlist = -->
 <xsl:template match="itemizedlist | db:itemizedlist">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'list itemizedlist'"/>
@@ -166,10 +181,13 @@ REMARK: Describe this module
       <xsl:apply-templates select="listitem | db:listitem"/>
     </ul>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = itemizedlist/listitem = -->
 <xsl:template match="itemizedlist/listitem | db:itemizedlist/db:listitem">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <li>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'list itemizedlist'"/>
@@ -188,6 +206,7 @@ REMARK: Describe this module
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates/>
   </li>
+  </xsl:if>
 </xsl:template>
 
 <!-- = member = -->
@@ -198,6 +217,8 @@ REMARK: Describe this module
 
 <!-- = orderedlist = -->
 <xsl:template match="orderedlist | db:orderedlist">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <xsl:variable name="start">
     <xsl:choose>
       <xsl:when test="@continuation = 'continues'">
@@ -243,10 +264,13 @@ REMARK: Describe this module
       <xsl:apply-templates select="listitem | db:listitem"/>
     </ol>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = orderedlist/listitem = -->
 <xsl:template match="orderedlist/listitem | db:orderedlist/db:listitem">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <li>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'list orderedlist'"/>
@@ -260,10 +284,13 @@ REMARK: Describe this module
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates/>
   </li>
+  </xsl:if>
 </xsl:template>
 
 <!-- = procedure = -->
 <xsl:template match="procedure | db:procedure">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'steps'"/>
@@ -287,10 +314,13 @@ REMARK: Describe this module
     </xsl:choose>
     </div>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = answer = -->
 <xsl:template match="answer | db:answer">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <dd>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'answer'"/>
@@ -313,15 +343,21 @@ REMARK: Describe this module
     </xsl:choose>
     <xsl:apply-templates/>
   </dd>
+  </xsl:if>
 </xsl:template>
 
 <!-- = qandaentry = -->
 <xsl:template match="qandaentry | db:qandaentry">
-  <xsl:apply-templates/>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
+    <xsl:apply-templates/>
+  </xsl:if>
 </xsl:template>
 
 <!-- = question = -->
 <xsl:template match="question | db:question">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <dt>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'question'"/>
@@ -344,6 +380,7 @@ REMARK: Describe this module
     </xsl:choose>
     <xsl:apply-templates/>
   </dt>
+  </xsl:if>
 </xsl:template>
 
 <!-- = seg = -->
@@ -364,33 +401,24 @@ REMARK: Describe this module
 
 <!-- = seglistitem = -->
 <xsl:template match="seglistitem | db:seglistitem">
-  <xsl:param name="position"
-              select="count(preceding-sibling::seglistitem) +
-                      count(preceding-sibling::db:seglistitem) + 1"/>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'seglistitem'"/>
     </xsl:call-template>
     <xsl:call-template name="html.lang.attrs"/>
-    <div>
-      <xsl:attribute name="class">
-        <xsl:choose>
-          <xsl:when test="($position mod 2) = 1">
-            <xsl:value-of select="'odd'"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:value-of select="'even'"/>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:attribute>
-      <xsl:apply-templates/>
-    </div>
+    <xsl:call-template name="db2html.anchor"/>
+    <xsl:apply-templates select="seg | db:seg"/>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- FIXME: Implement tabular segmentedlists -->
 <!-- = segmentedlist = -->
 <xsl:template match="segmentedlist | db:segmentedlist">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'list segmentedlist'"/>
@@ -400,6 +428,7 @@ REMARK: Describe this module
     <xsl:apply-templates select="title | db:title | db:info/db:title"/>
     <xsl:apply-templates select="seglistitem | db:seglistitem"/>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = segtitle = -->
@@ -416,6 +445,8 @@ REMARK: Describe this module
 
 <!-- = simplelist = -->
 <xsl:template match="simplelist | db:simplelist">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <xsl:variable name="columns">
     <xsl:choose>
       <xsl:when test="@columns">
@@ -426,6 +457,17 @@ REMARK: Describe this module
       </xsl:otherwise>
     </xsl:choose>
   </xsl:variable>
+  <xsl:variable name="allmembers" select="member | db:member"/>
+  <xsl:variable name="memberpos">
+    <xsl:for-each select="member | db:member">
+      <xsl:variable name="memberif">
+        <xsl:call-template name="db.profile.test"/>
+      </xsl:variable>
+      <xsl:if test="$memberif != ''">
+        <xsl:value-of select="concat(',', position())"/>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:variable>
   <xsl:choose>
     <xsl:when test="@type = 'inline'">
       <span>
@@ -434,13 +476,14 @@ REMARK: Describe this module
         </xsl:call-template>
         <xsl:call-template name="html.lang.attrs"/>
         <xsl:call-template name="db2html.anchor"/>
-        <xsl:for-each select="member | db:member">
+        <xsl:for-each select="str:split($memberpos, ',')">
           <xsl:if test="position() != 1">
             <xsl:call-template name="l10n.gettext">
               <xsl:with-param name="msgid" select="', '"/>
             </xsl:call-template>
           </xsl:if>
-          <xsl:apply-templates select="."/>
+          <xsl:variable name="pos" select="number(.)"/>
+          <xsl:apply-templates select="$allmembers[$pos]"/>
         </xsl:for-each>
       </span>
     </xsl:when>
@@ -452,20 +495,19 @@ REMARK: Describe this module
         <xsl:call-template name="html.lang.attrs"/>
         <xsl:call-template name="db2html.anchor"/>
         <table class="simplelist">
-          <xsl:for-each select="(member | db:member)[$columns = 1 or position() mod $columns = 1]">
+          <xsl:for-each select="str:split($memberpos, ',')[$columns = 1 or position() mod $columns = 1]">
+            <xsl:variable name="pos" select="number(.)"/>
             <tr>
               <td>
-                <xsl:apply-templates select="."/>
+                <xsl:apply-templates select="$allmembers[$pos]"/>
               </td>
-              <xsl:for-each select="(following-sibling::member |
-                                     following-sibling::db:member)[
-                                     position() &lt; $columns]">
+              <xsl:for-each select="following-sibling::*[position() &lt; $columns]">
+                <xsl:variable name="fpos" select="number(.)"/>
                 <td>
-                  <xsl:apply-templates select="."/>
+                  <xsl:apply-templates select="$allmembers[$fpos]"/>
                 </td>
               </xsl:for-each>
-              <xsl:variable name="fcount" select="count(following-sibling::member) +
-                                                  count(following-sibling::db:member)"/>
+              <xsl:variable name="fcount" select="count(following-sibling::*)"/>
               <xsl:if test="$fcount &lt; ($columns - 1)">
                 <td colspan="{$columns - $fcount - 1}"/>
               </xsl:if>
@@ -482,26 +524,24 @@ REMARK: Describe this module
         <xsl:call-template name="html.lang.attrs"/>
         <xsl:call-template name="db2html.anchor"/>
         <xsl:variable name="rows"
-                      select="ceiling(count(member | db:member) div $columns)"/>
+                      select="ceiling(count(str:split($memberpos, ',')) div $columns)"/>
         <table class="simplelist">
-          <xsl:for-each select="(member | db:member)[position() &lt;= $rows]">
+          <xsl:for-each select="str:split($memberpos, ',')[position() &lt;= $rows]">
+            <xsl:variable name="pos" select="number(.)"/>
             <tr>
               <td>
-                <xsl:apply-templates select="."/>
+                <xsl:apply-templates select="$allmembers[$pos]"/>
               </td>
-              <xsl:for-each select="(following-sibling::member |
-                                    following-sibling::db:member)[
-                                    position() mod $rows = 0]">
+              <xsl:for-each select="following-sibling::*[position() mod $rows = 0]">
+                <xsl:variable name="fpos" select="number(.)"/>
                 <td>
-                  <xsl:apply-templates select="."/>
+                  <xsl:apply-templates select="$allmembers[$fpos]"/>
                 </td>
               </xsl:for-each>
-              <xsl:if test="position() = $rows">
-                <xsl:variable name="fcount"
-                              select="count((following-sibling::member | 
following-sibling::db:member)[position() mod $rows = 0])"/>
-                <xsl:if test="$fcount &lt; ($columns - 1)">
-                  <td colspan="{$columns - $fcount - 1}"/>
-                </xsl:if>
+              <xsl:variable name="fcount"
+                            select="count(following-sibling::*[position() mod $rows = 0])"/>
+              <xsl:if test="$fcount &lt; ($columns - 1)">
+                <td/>
               </xsl:if>
             </tr>
           </xsl:for-each>
@@ -509,11 +549,14 @@ REMARK: Describe this module
       </div>
     </xsl:otherwise>
   </xsl:choose>
+  </xsl:if>
 </xsl:template>
 
 <!-- FIXME: Do something with @performance -->
 <!-- = step = -->
 <xsl:template match="step | db:step">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <li>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'steps'"/>
@@ -521,13 +564,15 @@ REMARK: Describe this module
     <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates/>
   </li>
+  </xsl:if>
 </xsl:template>
 
 <!-- FIXME: Do something with @performance -->
 <!-- = substeps = -->
 <xsl:template match="substeps | db:substeps">
-  <xsl:variable name="depth" select="count(ancestor::substeps |
-                                           ancestor::db:substeps)"/>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
+  <xsl:variable name="depth" select="count(ancestor::substeps | ancestor::db:substeps)"/>
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'steps substeps'"/>
@@ -545,10 +590,13 @@ REMARK: Describe this module
       <xsl:apply-templates/>
     </ol>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = term = -->
 <xsl:template match="term | db:term">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <dt>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'terms'"/>
@@ -563,10 +611,13 @@ REMARK: Describe this module
     <xsl:apply-templates select="db:info/db:title"/>
     <xsl:apply-templates/>
   </dt>
+  </xsl:if>
 </xsl:template>
 
 <!-- = variablelist = -->
 <xsl:template match="variablelist | db:variablelist">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'terms variablelist'"/>
@@ -580,12 +631,16 @@ REMARK: Describe this module
       <xsl:apply-templates select="varlistentry |db:varlistentry"/>
     </dl>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = varlistentry = -->
 <xsl:template match="varlistentry | db:varlistentry">
-  <xsl:apply-templates select="term | db:term"/>
-  <xsl:apply-templates select="listitem | db:listitem"/>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
+    <xsl:apply-templates select="term | db:term"/>
+    <xsl:apply-templates select="listitem | db:listitem"/>
+  </xsl:if>
 </xsl:template>
 
 <!-- = varlistentry/listitem = -->
diff --git a/xslt/docbook/html/db2html-media.xsl b/xslt/docbook/html/db2html-media.xsl
index 57bb29d..242f1fc 100644
--- a/xslt/docbook/html/db2html-media.xsl
+++ b/xslt/docbook/html/db2html-media.xsl
@@ -19,8 +19,9 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 xmlns:db="http://docbook.org/ns/docbook";
                 xmlns:mml="http://www.w3.org/1998/Math/MathML";
+                xmlns:str="http://exslt.org/strings";
                 xmlns="http://www.w3.org/1999/xhtml";
-                exclude-result-prefixes="db mml"
+                exclude-result-prefixes="db mml str"
                 version="1.0">
 
 <!--!!==========================================================================
@@ -82,7 +83,7 @@ calls *{db2html.mediaobject.fallback} for the contents of the #{audio} element.
 <!--**==========================================================================
 db2html.imagedata
 Output an HTML #{img} element for a #{imagedata} element.
-:Revision:version="3.8" date="2012-11-12" status="final"
+:Revision:version="3.10" date="2013-08-11" status="final"
 $node: The #{imagedata} or other graphic element.
 
 This template creates an #{img} element in the HTML output.  This template
@@ -90,6 +91,10 @@ is called not only for #{imagedata} elements, but also for #{graphic} and
 #{inlinegraphic} elements.  Note that #{graphic} and #{inlinegraphic} are
 deprecated and should not be used in any newly-written DocBook files.  Use
 #{mediaobject} instead.
+
+This template looks for a #{textobject} with a #{phrase} child in an ancestor
+#{mediaobject} or #{inlinemediaobject} element. It uses the first available,
+taking conditional processing into consideration.
 -->
 <xsl:template name="db2html.imagedata">
   <xsl:param name="node" select="."/>
@@ -119,10 +124,19 @@ deprecated and should not be used in any newly-written DocBook files.  Use
                                         self::db:imagedata/ancestor::db:mediaobject[1] |
                                         self::db:imagedata/ancestor::db:inlinemediaobject[1]
                                        )[last()]"/>
-    <xsl:variable name="alt" select="$media/textobject/phrase | $media/db:textobject/db:phrase"/>
-    <xsl:if test="$alt">
+    <xsl:variable name="alt" select="$media/textobject[phrase] | $media/db:textobject[db:phrase]"/>
+    <xsl:variable name="altpos">
+      <xsl:for-each select="$alt">
+        <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+        <xsl:if test="$if != ''">
+          <xsl:value-of select="concat(',', position())"/>
+        </xsl:if>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:if test="$altpos != ''">
       <xsl:attribute name="alt">
-        <xsl:value-of select="$alt[1]"/>
+        <xsl:variable name="obj" select="$alt[position() = number(str:split($altpos, ',')[1])]"/>
+        <xsl:value-of select="$obj/phrase | $obj/db:phrase"/>
       </xsl:attribute>
     </xsl:if>
   </img>
@@ -204,15 +218,16 @@ attribute on the HTML #{video} element. This template calls
 <!--**==========================================================================
 db2html.mediaobject
 Outputs HTML for a #{mediaobject} element.
-:Revision:version="3.8" date="2012-11-13" status="final"
+:Revision:version="3.10" date="2013-08-11" status="final"
 $node: The #{mediaobject} element.
 
 This template processes a #{mediaobject} element and outputs the appropriate
 HTML. DocBook allows multiple objects to be listed in a #{mediaobject} element.
 Processing tools are expected to choose the earliest suitable object. This
 template will select the first audio, image, or video object it can handle,
-filtering out images in non-web formats. If no suitable non-text objects are
-found, this template calls *{db2html.mediaobject.fallback}.
+filtering out images in non-web formats, and taking conditional processing
+into consideration. If no suitable non-text objects are found, this template
+calls *{db2html.mediaobject.fallback}.
 
 This template also detects MathML embedded in a DocBook 5 #{imagedata} element
 with the #{format} attribute #{"mathml"}, and passes it to the templates in
@@ -240,9 +255,17 @@ with the #{format} attribute #{"mathml"}, and passes it to the templates in
       @format = 'GIF'  or @format = 'GIF87a' or @format = 'GIF89a' or
       @format = 'JPEG' or @format = 'JPG'    or @format = 'PNG'    or
       not(@format)]] "/>
+  <xsl:variable name="objspos">
+    <xsl:for-each select="$objs">
+      <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+      <xsl:if test="$if != ''">
+        <xsl:value-of select="concat(',', position())"/>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:variable>
   <xsl:choose>
-    <xsl:when test="$objs">
-      <xsl:apply-templates select="$objs[1]"/>
+    <xsl:when test="$objspos != ''">
+      <xsl:apply-templates select="$objs[position() = number(str:split($objspos, ',')[1])]"/>
     </xsl:when>
     <xsl:otherwise>
       <xsl:call-template name="db2html.mediaobject.fallback">
@@ -256,24 +279,47 @@ with the #{format} attribute #{"mathml"}, and passes it to the templates in
 <!--**==========================================================================
 db2html.mediaobject.fallback
 Outputs fallback HTML for a #{mediaobject} element.
-:Revision:version="3.8" date="2012-11-13" status="final"
+:Revision:version="3.10" date="2013-08-11" status="final"
 $node: The #{mediaobject} element.
 
 This template outputs HTML for the first suitable #{textobject} child element
 of ${node}. If ${node} is an #{inlinemediaobject}, it looks for a #{textobject}
 that contains a #{phrase} element. Otherwise, it looks for a #{textobject} with
-normal block content.
+normal block content. It also handles conditional processing on the #{textobject}
+elements.
 -->
 <xsl:template name="db2html.mediaobject.fallback">
   <xsl:param name="node" select="."/>
   <xsl:choose>
     <xsl:when test="local-name($node) = 'inlinemediaobject'">
-      <xsl:apply-templates select="($node/textobject/phrase | $node/db:textobject/db:phrase)[1]"/>
+      <xsl:variable name="alt" select="$node/textobject[phrase] | $node/db:textobject[db:phrase]"/>
+      <xsl:variable name="altpos">
+        <xsl:for-each select="$alt">
+          <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+          <xsl:if test="$if != ''">
+            <xsl:value-of select="concat(',', position())"/>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:variable>
+      <xsl:if test="$altpos != ''">
+        <xsl:variable name="obj" select="$alt[position() = number(str:split($altpos, ',')[1])]"/>
+        <xsl:apply-templates select="$obj/phrase | $obj/db:phrase"/>
+      </xsl:if>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="($node/textobject[not(phrase or textdata)] |
-                                    $node/db:textobject[not(db:phrase or db:textdata)]
-                                   )[1]/*"/>
+      <xsl:variable name="alt" select="$node/textobject[not(phrase or textdata)] |
+                                       $node/db:textobject[not(db:phrase or db:textdata)]"/>
+      <xsl:variable name="altpos">
+        <xsl:for-each select="$alt">
+          <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+          <xsl:if test="$if != ''">
+            <xsl:value-of select="concat(',', position())"/>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:variable>
+      <xsl:if test="$altpos != ''">
+        <xsl:apply-templates select="$alt[position() = number(str:split($altpos, ',')[1])]/*"/>
+      </xsl:if>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
@@ -351,6 +397,8 @@ normal block content.
 
 <!-- = inlinemediaobject = -->
 <xsl:template match="inlinemediaobject | db:inlinemediaobject">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <span>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'inlinemediaobject'"/>
@@ -358,10 +406,13 @@ normal block content.
     <xsl:call-template name="db2html.anchor"/>
     <xsl:call-template name="db2html.mediaobject"/>
   </span>
+  </xsl:if>
 </xsl:template>
 
 <!-- = mediaojbect = -->
 <xsl:template match="mediaobject | db:mediaobject">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'mediaobject'"/>
@@ -378,6 +429,7 @@ normal block content.
       <xsl:apply-templates select="caption | db:caption"/>
     </xsl:if>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = videodata = -->
diff --git a/xslt/docbook/html/db2html-refentry.xsl b/xslt/docbook/html/db2html-refentry.xsl
index 1f1c0e8..342ea45 100644
--- a/xslt/docbook/html/db2html-refentry.xsl
+++ b/xslt/docbook/html/db2html-refentry.xsl
@@ -102,6 +102,8 @@ REMARK: Describe this module. Talk about refenty and friends
   <xsl:param name="depth_of_chunk">
     <xsl:call-template name="db.chunk.depth-of-chunk"/>
   </xsl:param>
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'refnamediv'"/>
@@ -130,6 +132,7 @@ REMARK: Describe this module. Talk about refenty and friends
     </xsl:call-template>
     <xsl:apply-templates select="refpurpose | db:refpurpose"/>
   </div>
+  </xsl:if>
   <!-- FIXME: what to do with refclass? -->
 </xsl:template>
 
diff --git a/xslt/docbook/html/db2html-table.xsl b/xslt/docbook/html/db2html-table.xsl
index cf8be87..541e180 100644
--- a/xslt/docbook/html/db2html-table.xsl
+++ b/xslt/docbook/html/db2html-table.xsl
@@ -978,6 +978,8 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
 
 <!-- = table = -->
 <xsl:template match="table | informaltable | db:table | db:informaltable">
+  <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
+  <xsl:if test="$if != ''">
   <div>
     <xsl:call-template name="html.class.attr">
       <xsl:with-param name="class" select="'table'"/>
@@ -1008,6 +1010,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
       </xsl:otherwise>
     </xsl:choose>
   </div>
+  </xsl:if>
 </xsl:template>
 
 <!-- = tgroup = -->
diff --git a/xslt/docbook/html/db2html.xsl b/xslt/docbook/html/db2html.xsl
index f4210d4..d909f3d 100644
--- a/xslt/docbook/html/db2html.xsl
+++ b/xslt/docbook/html/db2html.xsl
@@ -33,10 +33,10 @@ sets a namespace alias to output non-XML HTML. This stylesheet sets
 @{html.xhtml} to #{false}.
 -->
 
-<xsl:include href="db2xhtml.xsl" pass="true"><?pass?></xsl:include>
-
-<!--#@ html.xhtml -->
 <xsl:param name="html.xhtml" select="false()"/>
+<xsl:param name="db.profile.outputformat" select="'html'"/>
+
+<xsl:include href="db2xhtml.xsl" pass="true"><?pass?></xsl:include>
 
 <xsl:namespace-alias stylesheet-prefix="html" result-prefix="#default"/>
 <xsl:namespace-alias stylesheet-prefix="mml" result-prefix="#default"/>
diff --git a/xslt/docbook/html/db2xhtml.xsl b/xslt/docbook/html/db2xhtml.xsl
index 0c24c0e..c6da29a 100644
--- a/xslt/docbook/html/db2xhtml.xsl
+++ b/xslt/docbook/html/db2xhtml.xsl
@@ -38,10 +38,12 @@ DocBook documents into XHTML. This stylesheet sets the parameter
 
 <xsl:import href="../common/db-chunk.xsl"/>
 <xsl:import href="../common/db-common.xsl"/>
+<xsl:import href="../common/db-profile.xsl"/>
 <xsl:import href="../common/db-title.xsl"/>
 <xsl:import href="../common/db-xref.xsl"/>
 
 <xsl:param name="db.chunk.extension" select="$html.extension"/>
+<xsl:param name="db.profile.outputformat" select="'html;xhtml'"/>
 
 <xsl:include href="db2html-bibliography.xsl"/>
 <xsl:include href="db2html-block.xsl"/>


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