]> granicus.if.org Git - docbook-dsssl/commitdiff
Added initial, EXPERIMENTAL support for generating content for
authorMichael Smith <xmldoc@users.sourceforge.net>
Fri, 24 Jun 2005 07:20:40 +0000 (07:20 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Fri, 24 Jun 2005 07:20:40 +0000 (07:20 +0000)
HTML "title" attributes from content of the Alt element.

This change adds support for generating HTML "title" attributes
for the following inline elements only (all inlines -- support for
block elements will need to wait for later).

  abbrev accel acronym action application authorinitials beginpage
  citation citerefentry citetitle city classname code command
  comment computeroutput constant country database email envar
  errorcode errorname errortext errortype exceptionname fax
  filename firstname firstterm foreignphrase function glossterm
  guibutton guiicon guilabel guimenu guimenuitem guisubmenu
  hardware honorific interface interfacedefinition interfacename
  keycap keycode keysym lineage lineannotation literal markup
  medialabel methodname mousebutton option optional otheraddr
  othername package parameter personname phone pob postcode
  productname productnumber prompt property quote refentrytitle
  remark replaceable returnvalue sgmltag shortcut state street
  structfield structname subscript superscript surname symbol
  systemitem tag termdef token trademark type uri userinput
  varname wordasword

Implemented by creating a new named template, generate.html.title.
That is is currently called in eleven places only, in the
inline.xsl file. But it's called by all the inline.* templates
(e.g., inline.boldseq), which in turn are called by other
(element) templates, so it results, currently, in supporting
generation of the HTML "title" attribute for a total of about 93
elements (the list above).

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

index 2b21cdeff814791218ae90fd9a1ca1408c9b7cff..90d126c16a5e251dc160f15f73c67cf19810e380 100644 (file)
 
      ******************************************************************** -->
 
+<!-- The generate.html.title template is currently used for generating HTML -->
+<!-- "title" attributes for some inline elements only, but not for any -->
+<!-- block elements. It is called in eleven places in the inline.xsl -->
+<!-- file. But it's called by all the inline.* templates (e.g., -->
+<!-- inline.boldseq), which in turn are called by other (element) -->
+<!-- templates, so it results, currently, in supporting generation of the -->
+<!-- HTML "title" attribute for a total of about 92 elements. -->
+<xsl:template name="generate.html.title">
+  <xsl:if test="alt">
+    <xsl:attribute name="title">
+      <xsl:value-of select="alt"/>
+    </xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
 <xsl:template name="anchor">
   <xsl:param name="node" select="."/>
   <xsl:param name="conditional" select="1"/>
index 4ed9cd1b9cb5d791dc8dd1c96be6e89ccf8b3975..ce663553563c22fe723589f233d0f0338cc0ea42 100644 (file)
     </xsl:call-template>
   </xsl:param>
   <span class="{local-name(.)}">
+    <xsl:call-template name="generate.html.title"/>
     <xsl:if test="@dir">
       <xsl:attribute name="dir">
         <xsl:value-of select="@dir"/>
     </xsl:call-template>
   </xsl:param>
   <code class="{local-name(.)}">
+    <xsl:call-template name="generate.html.title"/>
     <xsl:if test="@dir">
       <xsl:attribute name="dir">
         <xsl:value-of select="@dir"/>
   </xsl:param>
 
   <span>
+    <xsl:call-template name="generate.html.title"/>
     <xsl:if test="@dir">
       <xsl:attribute name="dir">
         <xsl:value-of select="@dir"/>
     </xsl:call-template>
   </xsl:param>
   <em class="{local-name(.)}">
+    <xsl:call-template name="generate.html.title"/>
     <xsl:if test="@dir">
       <xsl:attribute name="dir">
         <xsl:value-of select="@dir"/>
                          or local-name(../..) = 'table'
                          or local-name(../..) = 'formalpara')">
       <code class="{local-name(.)}">
+        <xsl:call-template name="generate.html.title"/>
         <xsl:if test="@dir">
           <xsl:attribute name="dir">
             <xsl:value-of select="@dir"/>
     <xsl:otherwise>
       <strong class="{local-name(.)}">
         <code>
+          <xsl:call-template name="generate.html.title"/>
           <xsl:if test="@dir">
             <xsl:attribute name="dir">
               <xsl:value-of select="@dir"/>
   </xsl:param>
   <em class="{local-name(.)}">
     <code>
+      <xsl:call-template name="generate.html.title"/>
       <xsl:if test="@dir">
         <xsl:attribute name="dir">
           <xsl:value-of select="@dir"/>
     </xsl:call-template>
   </xsl:param>
   <sup>
+    <xsl:call-template name="generate.html.title"/>
     <xsl:if test="@dir">
       <xsl:attribute name="dir">
         <xsl:value-of select="@dir"/>
     </xsl:call-template>
   </xsl:param>
   <sub>
+    <xsl:call-template name="generate.html.title"/>
     <xsl:if test="@dir">
       <xsl:attribute name="dir">
         <xsl:value-of select="@dir"/>
 
 <xsl:template match="phrase">
   <span>
+    <xsl:call-template name="generate.html.title"/>
     <xsl:if test="@lang or @xml:lang">
       <xsl:call-template name="language.attribute"/>
     </xsl:if>
 
 <xsl:template match="termdef">
   <span class="{local-name(.)}">
+    <xsl:call-template name="generate.html.title"/>
     <xsl:call-template name="gentext.template">
       <xsl:with-param name="context" select="'termdef'"/>
       <xsl:with-param name="name" select="'prefix'"/>
   </xsl:param>
 
   <code class="sgmltag-{$class}">
+    <xsl:call-template name="generate.html.title"/>
     <xsl:choose>
       <xsl:when test="$class='attribute'">
         <xsl:apply-templates/>