]> granicus.if.org Git - docbook-dsssl/commitdiff
Now support xref to phrase, simpara, anchor, and quote,
authorBob Stayton <bobs@sagehill.net>
Fri, 13 Mar 2009 00:25:01 +0000 (00:25 +0000)
committerBob Stayton <bobs@sagehill.net>
Fri, 13 Mar 2009 00:25:01 +0000 (00:25 +0000)
most useful when an xrefstyle is used.

xsl/html/inline.xsl
xsl/html/xref.xsl

index f218c17992fa56bb57448c9ace7e3584400f715b..d39d30860cdafdf5d0111672041d4c39696b9d8a 100644 (file)
         <!-- Is it an olink ? -->
         <xsl:variable name="is.olink">
           <xsl:choose>
-           <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
+            <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
             <!-- and if the href contains # -->
             <xsl:when test="contains($xhref,'#') and
-                @xlink:role = $xolink.role">1</xsl:when>
+                 @xlink:role = $xolink.role">1</xsl:when>
             <xsl:otherwise>0</xsl:otherwise>
           </xsl:choose>
         </xsl:variable>
           </xsl:when>
 
           <xsl:when test="$is.olink = 1">
-           <xsl:call-template name="olink">
-             <xsl:with-param name="content" select="$content"/>
-           </xsl:call-template>
+            <xsl:call-template name="olink">
+              <xsl:with-param name="content" select="$content"/>
+            </xsl:call-template>
           </xsl:when>
 
           <!-- otherwise it's a URI -->
                 </xsl:attribute>
               </xsl:if>
 
-             <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target -->
-             <xsl:attribute name="target">
-               <xsl:choose>
-                 <xsl:when test="$target.show !=''">
-                   <xsl:value-of select="$target.show"/>
-                 </xsl:when>
-                 <xsl:otherwise>
-                 <xsl:value-of select="$ulink.target"/>
-                 </xsl:otherwise>
-               </xsl:choose>
-             </xsl:attribute>
-             
+              <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target -->
+              <xsl:attribute name="target">
+                <xsl:choose>
+                  <xsl:when test="$target.show !=''">
+                    <xsl:value-of select="$target.show"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                  <xsl:value-of select="$ulink.target"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:attribute>
+              
               <xsl:copy-of select="$content"/>
             </a>
           </xsl:otherwise>
       </xsl:with-param>
     </xsl:call-template>
   </xsl:variable>
-  <xsl:choose>
-    <xsl:when test="$depth mod 2 = 0">
-      <xsl:call-template name="gentext.startquote"/>
-      <xsl:call-template name="inline.charseq"/>
-      <xsl:call-template name="gentext.endquote"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:call-template name="gentext.nestedstartquote"/>
-      <xsl:call-template name="inline.charseq"/>
-      <xsl:call-template name="gentext.nestedendquote"/>
-    </xsl:otherwise>
-  </xsl:choose>
+  <span>
+    <xsl:apply-templates select="." mode="class.attribute"/>
+    <xsl:call-template name="anchor"/>
+    <xsl:choose>
+      <xsl:when test="$depth mod 2 = 0">
+        <xsl:call-template name="gentext.startquote"/>
+        <xsl:call-template name="inline.charseq"/>
+        <xsl:call-template name="gentext.endquote"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="gentext.nestedstartquote"/>
+        <xsl:call-template name="inline.charseq"/>
+        <xsl:call-template name="gentext.nestedendquote"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </span>
 </xsl:template>
 
 <xsl:template match="varname">
           </xsl:call-template>
         </xsl:attribute>
 
-       <xsl:choose>
-         <xsl:when test="$bibliography.numbered != 0">
-           <xsl:apply-templates select="$target" mode="citation"/>
-         </xsl:when>
-         <xsl:otherwise>
-           <xsl:call-template name="inline.charseq"/>
-         </xsl:otherwise>
-       </xsl:choose>
+        <xsl:choose>
+          <xsl:when test="$bibliography.numbered != 0">
+            <xsl:apply-templates select="$target" mode="citation"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="inline.charseq"/>
+          </xsl:otherwise>
+        </xsl:choose>
 
       </a>
       <xsl:text>]</xsl:text>
           </xsl:call-template>
         </xsl:attribute>
 
-       <xsl:call-template name="inline.charseq"/>
+        <xsl:call-template name="inline.charseq"/>
 
       </a>
       <xsl:text>]</xsl:text>
 
 <xsl:template match="biblioentry|bibliomixed" mode="citation">
   <xsl:number from="bibliography" count="biblioentry|bibliomixed"
-             level="any" format="1"/>
+              level="any" format="1"/>
 </xsl:template>
 
 <!-- ==================================================================== -->
index 01ebe3364c1356e09503f9259c4536fa4fbc5a63..3c28adbaaef672a1a2bf767be92dc72a58c9190b 100644 (file)
   </xsl:apply-templates>
 </xsl:template>
 
-<xsl:template match="para" mode="xref-to">
+<!-- These are elements for which no link text exists, so an xref to one
+     uses the xrefstyle attribute if specified, or if not it falls back
+     to the container element's link text -->
+<xsl:template match="para|phrase|simpara|anchor|quote" mode="xref-to">
   <xsl:param name="referrer"/>
   <xsl:param name="xrefstyle"/>
   <xsl:param name="verbose" select="1"/>
                                        |ancestor::listitem
                                        |ancestor::varlistentry)[last()]"/>
 
-  <xsl:apply-templates select="$context" mode="xref-to">
-    <xsl:with-param name="purpose" select="'xref'"/>
-    <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
-    <xsl:with-param name="referrer" select="$referrer"/>
-    <xsl:with-param name="verbose" select="$verbose"/>
-  </xsl:apply-templates>
+  <xsl:choose>
+    <xsl:when test="$xrefstyle != ''">
+      <xsl:apply-templates select="." mode="object.xref.markup">
+        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+        <xsl:with-param name="referrer" select="$referrer"/>
+        <xsl:with-param name="verbose" select="$verbose"/>
+      </xsl:apply-templates>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="$context" mode="xref-to">
+        <xsl:with-param name="purpose" select="'xref'"/>
+        <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+        <xsl:with-param name="referrer" select="$referrer"/>
+        <xsl:with-param name="verbose" select="$verbose"/>
+      </xsl:apply-templates>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <!-- ==================================================================== -->