Hello Bob & everyone

If you are using DocBook 5, you could use an <annotation> element to contain the hover title. You would need to write the XSL customization to process the annotation, of course. See this reference for more info:

http://www.sagehill.net/docbookxsl/Db5Tools.html#Db5Annotations

Thanks for that helpful clue (and indeed for your book :-) ). Somewhat to my surprise (given I've not done much of this stuff), I've managed to make it do what I wanted! in what I think is probably a fairly un-robust way, but OK for me since I'm the only one using this setup.

In case it's useful to anyone else, this is what I did...


In the XML document, I have

<footnote xml:id="whatever" role="ref">
  <annotation>
    <para>
      My title tag to appear on hover
    </para>
  </annotation>
  <para>
    ... footnote text ...
  </para>
</footnote>


Within <xsl:template match="footnote">, I have a new variable

<xsl:variable name="annotitle">
  <xsl:value-of select="child::annotation/para"/>
</xsl:variable>

And then when it gets to what would have been
<a name="{$name}" href="{$href}">

it's now
<a name="{$name}" href="{$href}" title="{$annotitle}">

so that's the hoverable title.


Then to toggle the bold & non bold, I'm using <footnote role="">, which can be either "material" or "ref" (for completeness/clarity, though in fact at the moment I'm only testing for the former and the latter is ignored.)

In the template I've doubled up one existing bit and used <xml:choose> to pick which one to use.

<xsl:choose>
<xsl:when test="@role='material'"> <!-- bolded if footnote has additional material -->
    <sup>
      <b> <!-- new bit -->
        <xsl:text></xsl:text>
        <a name="{$name}" href="{$href}" title="{$annotitle}">
          <xsl:apply-templates select="." mode="class.attribute"/>
          <xsl:apply-templates select="." mode="footnote.number"/>
        </a>
        <xsl:text></xsl:text>
      </b> <!-- other new bit -->
    </sup>
  </xsl:when>
  <xsl:otherwise> <!-- no discussion, just a ref -->
... continues with same thing except without the bold tags.


What's unrobust about it that I already know:

1. It ignores everything in the <annotation> except the first paragraph. A title tag in HTML would only be one line anyway, so if there _were_ a load of other stuff in the annotation, ignoring it would be a fairly sensible course - but in an ideal world the editor would prevent me having other unusable stuff there, which it doesn't know to do.

2. It doesn't use <annotation>'s identity linking - it knows which one goes with what only because it's inside <footnote>. Which is OK given how I plan to use it.


If I've stored up other problems for myself doing it that way then feel free to tell me :-)


I haven't done anything about <footnoteref>s yet. It would be nice to give those titles too, but then (i.i.u.c.) I'd have to work out addressing by id, as they don't have content where I could stick the <annotation>.


Jennifer

--
www.uncharted-worlds.org/blog/

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org

Reply via email to