[yelp-xsl] [db2html-xref] Adding DocBook 5 support.



commit 0c6e5195dbb8a0eab19747718ac599a075b74085
Author: brian m. carlson <sandals crustytoothpaste ath cx>
Date:   Mon Mar 8 20:17:12 2010 +0000

    [db2html-xref] Adding DocBook 5 support.
    
    This includes part of the code for ubiquitous linking.
    
    Signed-off-by: brian m. carlson <sandals crustytoothpaste ath cx>

 xslt/docbook/html/db2html-xref.xsl |   39 +++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/xslt/docbook/html/db2html-xref.xsl b/xslt/docbook/html/db2html-xref.xsl
index b7f0a31..ed5639d 100644
--- a/xslt/docbook/html/db2html-xref.xsl
+++ b/xslt/docbook/html/db2html-xref.xsl
@@ -17,7 +17,10 @@ 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:xl="http://www.w3.org/1999/xlink";
                 xmlns="http://www.w3.org/1999/xhtml";
+                exclude-result-prefixes="xl db"
                 version="1.0">
 
 <!--!!==========================================================================
@@ -36,9 +39,9 @@ $name: The text to use for the #{name} attribute
 
 REMARK: Describe this template
 -->
-<xsl:template name="db2html.anchor" match="anchor">
+<xsl:template name="db2html.anchor" match="anchor | db:anchor">
   <xsl:param name="node" select="."/>
-  <xsl:param name="name" select="$node/@id"/>
+  <xsl:param name="name" select="$node/@id | $node/@xml:id"/>
   <xsl:if test="$name"><a name="{$name}"/></xsl:if>
 </xsl:template>
 
@@ -109,6 +112,36 @@ REMARK: Describe this template
 
 
 <!--**==========================================================================
+db2html.xlink
+Generates a hyperlink from a DocBook 5 #{link} element
+$linkend: The ID of the element to link to
+$url: The URL to link to
+$content: Optional content to use for the text of the link
+
+Note that this template is also called for inline elements that use DocBook 5's ubiquitous linking.
+-->
+<xsl:template name="db2html.xlink" match="db:link">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="linkend" select="$node/@linkend"/>
+  <xsl:param name="url" select="$node/@xl:href"/>
+  <xsl:param name="content" select="false()"/>
+  <xsl:choose>
+    <xsl:when test="$url">
+      <xsl:call-template name="db2html.ulink">
+        <xsl:with-param name="url" select="$url"/>
+        <xsl:with-param name="content" select="$content"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$linkend">
+      <xsl:call-template name="db2html.link">
+        <xsl:with-param name="linkend" select="$linkend"/>
+      </xsl:call-template>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+
+<!--**==========================================================================
 db2html.xref
 Generates a hyperlink from an #{xref} element
 $linkend: The id of the element being linked to
@@ -119,7 +152,7 @@ $content: Optional content to use for the text of the link
 
 REMARK: Describe this template
 -->
-<xsl:template name="db2html.xref" match="xref">
+<xsl:template name="db2html.xref" match="xref | db:xref">
   <xsl:param name="linkend"   select="@linkend"/>
   <xsl:param name="target"    select="key('idkey', $linkend)"/>
   <xsl:param name="endterm"   select="@endterm"/>



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