]> granicus.if.org Git - docbook-dsssl/commitdiff
Reworked titlepage template processing to support use of more interesting
authorNorman Walsh <ndw@nwalsh.com>
Mon, 21 May 2001 18:10:47 +0000 (18:10 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Mon, 21 May 2001 18:10:47 +0000 (18:10 +0000)
predicates.

Note: in previous versions, at most one title, subtitle, or titleabbrev
element would be processed for each title page. In the new design, if you
have multiple title, subtitle, or titleabbrev elements inside an info
wrapper (you shouldn't!), they will all be processed.

xsl/fo/titlepage.templates.xml
xsl/html/titlepage.templates.xml
xsl/template/titlepage.xsl

index f479b22bbe859bb723088327481456d6cc6d319f..92fefe6234432ccd244f8e3cd7baf87efa2a49dd 100644 (file)
@@ -21,7 +21,7 @@
 
 <t:titlepage element="article" wrapper="fo:block">
   <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             named-template="component.title"
             param:node="ancestor-or-self::article[1]"
             fo:margin-left="-4pc"
@@ -29,7 +29,7 @@
             fo:font-size="&hsize5;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
 <t:titlepage element="set" wrapper="fo:block">
   <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             named-template="division.title"
             param:node="ancestor-or-self::set[1]"
             fo:font-size="&hsize5;"
             fo:space-before="&hsize5space;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
   <t:titlepage element="book" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             named-template="division.title"
             param:node="ancestor-or-self::book[1]"
             fo:font-size="&hsize5;"
             fo:space-before="&hsize5space;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:font-size="&hsize4;"
                fo:space-before="&hsize4space;"
                fo:font-family="{$title.font.family}"/>
     </t:titlepage-content>
 
   <t:titlepage-content side="verso">
-      <title predicate="[1]"
+      <title
             fo:font-size="&hsize2;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
 
 <t:titlepage element="part" wrapper="fo:block">
   <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             named-template="division.title"
             param:node="ancestor-or-self::part[1]"
             fo:font-size="&hsize5;"
             fo:space-before="&hsize5space;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-size="&hsize4;"
              fo:space-before="&hsize4space;"
              fo:font-weight='bold'
 
 <t:titlepage element="partintro" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:font-size="&hsize3;"
           fo:font-weight="bold"
           fo:margin-left="-4pc"
           fo:space-before="1em"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-size="&hsize2;"
              fo:font-weight="bold"
              fo:font-style="italic"
 
 <t:titlepage element="reference" wrapper="fo:block">
   <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             named-template="division.title"
             param:node="ancestor-or-self::reference[1]"
             fo:font-size="&hsize5;"
             fo:space-before="&hsize5space;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
   <t:titlepage element="dedication" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="component.title"
             param:node="ancestor-or-self::dedication[1]"
             fo:font-size="&hsize3;"
             fo:font-family="{$title.font.family}"
             fo:font-weight="bold"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:font-family="{$title.font.family}"/>
     </t:titlepage-content>
 
 
   <t:titlepage element="preface" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="component.title"
             param:node="ancestor-or-self::preface[1]"
             fo:font-size="&hsize3;"
             fo:font-family="{$title.font.family}"
             fo:font-weight="bold"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:font-family="{$title.font.family}"/>
       <corpauthor/>
       <authorgroup/>
 
   <t:titlepage element="chapter" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             named-template="component.title"
             param:node="ancestor-or-self::chapter[1]"
             fo:margin-left="-4pc"
             fo:font-size="&hsize3;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:space-before="0.5em"
                fo:margin-left="-4pc"
                fo:font-style="italic"
 
   <t:titlepage element="appendix" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             named-template="component.title"
             param:node="ancestor-or-self::appendix[1]"
             fo:margin-left="-4pc"
             fo:font-size="&hsize3;"
             fo:font-weight="bold"
             fo:font-family="{$title.font.family}"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:font-family="{$title.font.family}"/>
       <corpauthor/>
       <authorgroup/>
 
 <t:titlepage element="section" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:margin-left="-4pc"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
 <t:titlepage element="sect1" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:margin-left="-4pc"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
 <t:titlepage element="sect2" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:margin-left="-4pc"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
 <t:titlepage element="sect3" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:margin-left="-4pc"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
 <t:titlepage element="sect4" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:margin-left="-4pc"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
 <t:titlepage element="sect5" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:margin-left="-4pc"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
 <t:titlepage element="simplesect" wrapper="fo:block">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           fo:margin-left="-4pc"
           fo:font-family="{$title.font.family}"/>
-    <subtitle predicate="[1]"
+    <subtitle
              fo:font-family="{$title.font.family}"/>
     <corpauthor/>
     <authorgroup/>
 
   <t:titlepage element="bibliography" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="component.title"
             param:node="ancestor-or-self::bibliography[1]"
             fo:font-size="&hsize3;"
             fo:font-family="{$title.font.family}"
             fo:font-weight="bold"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:font-family="{$title.font.family}"/>
     </t:titlepage-content>
 
 
   <t:titlepage element="glossary" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="component.title"
             param:node="ancestor-or-self::glossary[1]"
             fo:font-size="&hsize3;"
             fo:font-family="{$title.font.family}"
             fo:font-weight="bold"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:font-family="{$title.font.family}"/>
     </t:titlepage-content>
 
 
   <t:titlepage element="index" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="component.title"
             param:node="ancestor-or-self::index[1]"
             fo:font-size="&hsize3;"
             fo:font-family="{$title.font.family}"
             fo:font-weight="bold"/>
-      <subtitle predicate="[1]"
+      <subtitle
                fo:font-family="{$title.font.family}"/>
     </t:titlepage-content>
 
 
   <t:titlepage element="table.of.contents" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="gentext"
             param:key="'TableofContents'"
 
   <t:titlepage element="list.of.tables" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="gentext"
             param:key="'ListofTables'"
 
   <t:titlepage element="list.of.figures" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="gentext"
             param:key="'ListofFigures'"
 
   <t:titlepage element="list.of.examples" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="gentext"
             param:key="'ListofExamples'"
 
   <t:titlepage element="list.of.equations" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="gentext"
             param:key="'ListofEquations'"
 
   <t:titlepage element="list.of.unknowns" wrapper="fo:block">
     <t:titlepage-content side="recto">
-      <title predicate="[1]"
+      <title
             force="1"
             named-template="gentext"
             param:key="'ListofUnknown'"
index 5c01447f020ee903bc52420f47e14ca82e182784..f872e895242471eb9a45586cca1ec99267cf72db 100644 (file)
@@ -6,8 +6,8 @@
 
 <t:titlepage element="article" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
@@ -38,8 +38,8 @@
 
 <t:titlepage element="set" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
@@ -70,8 +70,8 @@
 
 <t:titlepage element="book" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="part" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="partintro" wrapper="div">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="reference" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
   <t:titlepage element="dedication" wrapper="div" class="titlepage">
     <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           force="1"
           named-template="component.title"
           param:node="ancestor-or-self::dedication[1]"/>
-    <subtitle predicate="[1]"/>
+    <subtitle/>
     </t:titlepage-content>
 
   <t:titlepage-content side="verso">
 
 <t:titlepage element="preface" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="chapter" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="appendix" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="section" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="sect1" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="sect2" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="sect3" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="sect4" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="sect5" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="simplesect" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"/>
-    <subtitle predicate="[1]"/>
+    <title/>
+    <subtitle/>
     <corpauthor/>
     <authorgroup/>
     <author/>
 
 <t:titlepage element="bibliography" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           force="1"
           named-template="component.title"
           param:node="ancestor-or-self::bibliography[1]"/>
-    <subtitle predicate="[1]"/>
+    <subtitle/>
   </t:titlepage-content>
 
   <t:titlepage-content side="verso">
 
 <t:titlepage element="glossary" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           force="1"
           named-template="component.title"
           param:node="ancestor-or-self::glossary[1]"/>
-    <subtitle predicate="[1]"/>
+    <subtitle/>
   </t:titlepage-content>
 
   <t:titlepage-content side="verso">
 
 <t:titlepage element="index" wrapper="div" class="titlepage">
   <t:titlepage-content side="recto">
-    <title predicate="[1]"
+    <title
           force="1"
           named-template="component.title"
           param:node="ancestor-or-self::index[1]"/>
-    <subtitle predicate="[1]"/>
+    <subtitle/>
   </t:titlepage-content>
 
   <t:titlepage-content side="verso">
index 6b08fcff14cd9dd7a6d0beeb766e30ffc8726c1c..200fb382f95d432b19214517d77f0d0f9392d19e 100644 (file)
@@ -269,11 +269,14 @@ and <quote>verso</quote> sides of the title page.</para>
     </xsl:element>
   </xsl:if>
 
-  <!-- output default templates for each of the elements listed in -->
-  <!-- the titlepage-content -->
+  <!-- output default templates for each of the elements listed in  -->
+  <!-- the titlepage-content. If a template is suppressed or forced -->
+  <!-- to be off, or has already been output, don't output it.      -->
   <xsl:for-each select="t:titlepage-content/*">
+    <xsl:variable name="thisnode" select="."/>
     <xsl:if test="(not(@suppress-template) or @suppress-template='0')
-                  and (not(@force) or @force='0')">
+                  and (not(@force) or @force='0')
+                  and (not(preceding-sibling::*[name(.)=name($thisnode)]))">
       <xsl:text>&#xA;&#xA;</xsl:text>
       <xsl:element name="xsl:template">
         <xsl:attribute name="match">
@@ -679,31 +682,31 @@ names.</para>
     <xsl:text>|</xsl:text>
   </xsl:if>
 
-  <xsl:if test="@predicate">
-    <xsl:text>(</xsl:text>
-  </xsl:if>
-
   <xsl:value-of select="$docinfo"/>
   <xsl:text>/</xsl:text>
   <xsl:value-of select="name(.)"/>
+  <xsl:if test="@predicate">
+    <xsl:value-of select="@predicate"/>
+  </xsl:if>
 
   <xsl:if test="$altinfo != ''">
     <xsl:text>|</xsl:text>
     <xsl:value-of select="$altinfo"/>
     <xsl:text>/</xsl:text>
     <xsl:value-of select="name(.)"/>
+    <xsl:if test="@predicate">
+      <xsl:value-of select="@predicate"/>
+    </xsl:if>
   </xsl:if>
 
-  <xsl:if test="name(.) = 'title'
-                or name(.) = 'subtitle'
-                or name(.) = 'titleabbrev'">
+  <xsl:if test="local-name(.) = 'title'
+                or local-name(.) = 'subtitle'
+                or local-name(.) = 'titleabbrev'">
     <xsl:text>|</xsl:text>
     <xsl:value-of select="name(.)"/>
-  </xsl:if>
-
-  <xsl:if test="@predicate">
-    <xsl:text>)</xsl:text>
-    <xsl:value-of select="@predicate"/>
+    <xsl:if test="@predicate">
+      <xsl:value-of select="@predicate"/>
+    </xsl:if>
   </xsl:if>
 </xsl:template>
 
@@ -819,39 +822,122 @@ names.</para>
       </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:element name="xsl:apply-templates">
-        <xsl:attribute name="mode">
-          <xsl:value-of select="$mode"/>
-        </xsl:attribute>
-        <xsl:attribute name="select">
-          <xsl:if test="@predicate">
-            <xsl:text>(</xsl:text>
-          </xsl:if>
 
-          <xsl:value-of select="$docinfo"/>
-          <xsl:text>/</xsl:text>
-          <xsl:value-of select="name(.)"/>
+      <xsl:choose>
+        <xsl:when test="local-name(.) = 'title'
+                        or local-name(.) = 'subtitle'
+                        or local-name(.) = 'titleabbrev'">
+          <!-- the title, subtitle, and titleabbrev elements are special -->
+          <xsl:element name="xsl:choose">
+            <xsl:text>&#xA;    </xsl:text>
+            <xsl:element name="xsl:when">
+              <xsl:attribute name="test">
+                <xsl:value-of select="$docinfo"/>
+                <xsl:text>/</xsl:text>
+                <xsl:value-of select="name(.)"/>
+              </xsl:attribute>
+              <xsl:text>&#xA;      </xsl:text>
+              <xsl:element name="xsl:apply-templates">
+                <xsl:attribute name="mode">
+                  <xsl:value-of select="$mode"/>
+                </xsl:attribute>
+                <xsl:attribute name="select">
+                  <xsl:value-of select="$docinfo"/>
+                  <xsl:text>/</xsl:text>
+                  <xsl:value-of select="name(.)"/>
+                  <xsl:if test="@predicate">
+                    <xsl:value-of select="@predicate"/>
+                  </xsl:if>
+                </xsl:attribute>
+              </xsl:element>
+              <xsl:text>&#xA;    </xsl:text>
+            </xsl:element>
 
-          <xsl:if test="$altinfo != ''">
-            <xsl:text>|</xsl:text>
-            <xsl:value-of select="$altinfo"/>
-            <xsl:text>/</xsl:text>
-            <xsl:value-of select="name(.)"/>
-          </xsl:if>
+            <xsl:if test="$altinfo != ''">
+              <xsl:text>&#xA;    </xsl:text>
+              <xsl:element name="xsl:when">
+                <xsl:attribute name="test">
+                  <xsl:value-of select="$altinfo"/>
+                  <xsl:text>/</xsl:text>
+                  <xsl:value-of select="name(.)"/>
+                </xsl:attribute>
+                <xsl:text>&#xA;      </xsl:text>
+                <xsl:element name="xsl:apply-templates">
+                  <xsl:attribute name="mode">
+                    <xsl:value-of select="$mode"/>
+                  </xsl:attribute>
+                  <xsl:attribute name="select">
+                    <xsl:value-of select="$altinfo"/>
+                    <xsl:text>/</xsl:text>
+                    <xsl:value-of select="name(.)"/>
+                    <xsl:if test="@predicate">
+                      <xsl:value-of select="@predicate"/>
+                    </xsl:if>
+                  </xsl:attribute>
+                </xsl:element>
+                <xsl:text>&#xA;    </xsl:text>
+              </xsl:element>
+            </xsl:if>
 
-          <xsl:if test="name(.) = 'title'
-                        or name(.) = 'subtitle'
-                        or name(.) = 'titleabbrev'">
-            <xsl:text>|</xsl:text>
-            <xsl:value-of select="name(.)"/>
-          </xsl:if>
+            <xsl:text>&#xA;    </xsl:text>
+            <xsl:element name="xsl:when">
+              <xsl:attribute name="test">
+                <xsl:value-of select="name(.)"/>
+              </xsl:attribute>
+              <xsl:text>&#xA;      </xsl:text>
+              <xsl:element name="xsl:apply-templates">
+                <xsl:attribute name="mode">
+                  <xsl:value-of select="$mode"/>
+                </xsl:attribute>
+                <xsl:attribute name="select">
+                  <xsl:value-of select="name(.)"/>
+                  <xsl:if test="@predicate">
+                    <xsl:value-of select="@predicate"/>
+                  </xsl:if>
+                </xsl:attribute>
+              </xsl:element>
+              <xsl:text>&#xA;    </xsl:text>
+            </xsl:element>
+            <xsl:text>&#xA;  </xsl:text>
+          </xsl:element>
+          <xsl:text>&#xA;</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+
+          <!-- first take care of the $docinfo version -->
+          <xsl:element name="xsl:apply-templates">
+            <xsl:attribute name="mode">
+              <xsl:value-of select="$mode"/>
+            </xsl:attribute>
+            <xsl:attribute name="select">
+              <xsl:value-of select="$docinfo"/>
+              <xsl:text>/</xsl:text>
+              <xsl:value-of select="name(.)"/>
+              <xsl:if test="@predicate">
+                <xsl:value-of select="@predicate"/>
+              </xsl:if>
+            </xsl:attribute>
+          </xsl:element>
 
-          <xsl:if test="@predicate">
-            <xsl:text>)</xsl:text>
-            <xsl:value-of select="@predicate"/>
+          <!-- then take care of the $altinfo version -->
+          <xsl:if test="$altinfo != ''">
+            <xsl:text>&#xA;  </xsl:text>
+            <xsl:element name="xsl:apply-templates">
+              <xsl:attribute name="mode">
+                <xsl:value-of select="$mode"/>
+              </xsl:attribute>
+              <xsl:attribute name="select">
+                <xsl:value-of select="$altinfo"/>
+                <xsl:text>/</xsl:text>
+                <xsl:value-of select="name(.)"/>
+                <xsl:if test="@predicate">
+                  <xsl:value-of select="@predicate"/>
+                </xsl:if>
+              </xsl:attribute>
+            </xsl:element>
           </xsl:if>
-        </xsl:attribute>
-      </xsl:element>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>