]> granicus.if.org Git - docbook-dsssl/commitdiff
Cleaned up template that handles adding markup for sgmltag|tag
authorMichael Smith <xmldoc@users.sourceforge.net>
Tue, 17 Jul 2007 14:08:46 +0000 (14:08 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Tue, 17 Jul 2007 14:08:46 +0000 (14:08 +0000)
instances that are DocBook element names.

xsl/tools/xsl/build/tdg-link.xsl

index 5ceed114c47ee5050c915b413f0215a223e90c93..a2adde3a8b01d6846e6a8806caf302a13c383e41 100644 (file)
@@ -1,55 +1,43 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                version="1.0">
+  version="1.0">
 
-<xsl:include href="docbook-elements.xsl"/>
-
-<xsl:param name="tdg-baseuri" select="'http://docbook.org/tdg/en/html/'"/>
-
-<xsl:template match="sgmltag|tag">
-  <xsl:variable name="tagmarkup">
-    <xsl:apply-imports/>
-  </xsl:variable>
-
-  <xsl:choose>
-    <xsl:when test="not(@class) or @class='element'">
-      <xsl:variable name="base-element">
-        <xsl:choose>
-          <xsl:when test="contains(normalize-space(.), ' ')">
-            <xsl:value-of select="substring-before(normalize-space(.), ' ')"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:value-of select="normalize-space(.)"/>
-          </xsl:otherwise>
-        </xsl:choose>
-      </xsl:variable>
-
-      <xsl:variable name="element"
-                    select="translate($base-element,
-                                      'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
-                                      'abcdefghijklmnopqrstuvwxyz')"/>
-
-      <xsl:variable name="isdocbook">
-        <xsl:call-template name="is-docbook-element">
-          <xsl:with-param name="element" select="$element"/>
-        </xsl:call-template>
-      </xsl:variable>
+  <xsl:include href="docbook-elements.xsl"/>
+  <xsl:param name="tdg-baseuri" select="'http://docbook.org/tdg/en/html/'"/>
 
+  <xsl:template match="tag[not(@class) or @class='element']
+    |sgmltag[not(@class) or @class='element']">
+    <xsl:variable name="tagmarkup">
+      <xsl:apply-imports/>
+    </xsl:variable>
+    <xsl:variable name="base-element">
       <xsl:choose>
-        <xsl:when test="$isdocbook != 0">
-          <a href="{concat($tdg-baseuri, normalize-space($element))}.html">
-            <xsl:copy-of select="$tagmarkup"/>
-          </a>
+        <xsl:when test="contains(normalize-space(.), ' ')">
+          <xsl:value-of select="substring-before(normalize-space(.), ' ')"/>
         </xsl:when>
         <xsl:otherwise>
-          <xsl:copy-of select="$tagmarkup"/>
+          <xsl:value-of select="normalize-space(.)"/>
         </xsl:otherwise>
       </xsl:choose>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:copy-of select="$tagmarkup"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
+    </xsl:variable>
+    <xsl:variable name="element"
+      select="translate($base-element,
+      'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+      'abcdefghijklmnopqrstuvwxyz')"/>
+    <xsl:variable name="isdocbook">
+      <xsl:call-template name="is-docbook-element">
+        <xsl:with-param name="element" select="$element"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="$isdocbook != 0">
+        <a href="{concat($tdg-baseuri, normalize-space($element))}.html">
+          <xsl:copy-of select="$tagmarkup"/>
+        </a>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$tagmarkup"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
 </xsl:stylesheet>