OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Specify XHTML "<a title=..." in "<ulink ..."?


I'd suggest customizing the whole template with match="ulink" from 
xhtml/xref.xsl.  It is only 35 lines long, and you could put the title 
attribute on the <a> element rather than a span.  Wouldn't that give you 
better behavior in browsers to display the title when hovering?

You could also take the title text from the url value or the text value of 
the ulink if it contains text nodes.  Using xreflabel instead of role is an 
option as well, although that is not the intended semantics for xreflabel. 
Something like this (untested):

<xsl:template match="ulink" name="ulink">
  <xsl:param name="url" select="@url"/>
  <xsl:variable name="link">
    <a>
      <xsl:apply-templates select="." mode="class.attribute"/>
      <xsl:if test="@id or @xml:id">
        <xsl:attribute name="id">
          <xsl:value-of select="(@id|@xml:id)[1]"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:attribute name="href"><xsl:value-of 
select="$url"/></xsl:attribute>
      <xsl:if test="$ulink.target != ''">
        <xsl:attribute name="target">
          <xsl:value-of select="$ulink.target"/>
        </xsl:attribute>
      </xsl:if>
 <!-- *************  add these three lines ************ -->
      <xsl:if test="string-length(@xreflabel) != 0">
        <xsl:attribute name="title"><xsl:value-of 
select="@xreflabel"/></xsl:attribute>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="count(child::node())=0">
          <xsl:value-of select="$url"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates/>
        </xsl:otherwise>
      </xsl:choose>
    </a>
  </xsl:variable>

  <xsl:choose>
    <xsl:when test="function-available('suwl:unwrapLinks')">
      <xsl:copy-of select="suwl:unwrapLinks($link)"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:copy-of select="$link"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


Bob Stayton
Sagehill Enterprises
bobs@sagehill.net


----- Original Message ----- 
From: "W. Martin Borgert" <debacle@debian.org>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, October 06, 2008 6:04 AM
Subject: [docbook-apps] Specify XHTML "<a title=..." in "<ulink ..."?


> Hi,
>
> unfortunately this is hard to search for in internet search
> engines: Is there a way to specify something in a ulink that
> creates a title for an XHTML <a> element with the DocBook XSL
> stylesheets? I did not find anything in xhtml/xref.xsl. I'm
> still using DocBook 4.5 with stylesheets 1.73.2.
>
> It's easy to (mis)use the role attribute, but it seems not clean
> to me and maybe I will need the role for another purpose.
>
>  <xsl:template match="ulink[string-length(@role)>0]">
>    <span xmlns="http://www.w3.org/1999/xhtml";>
>      <xsl:attribute name="title">
>        <xsl:value-of select="@role"/>
>      </xsl:attribute>
>      <xsl:apply-imports/>
>    </span>
>  </xsl:template>
>
> TIA!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
> 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]