[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Reusing XML content as I publish

Subject: RE: [xsl] Reusing XML content as I publish
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 28 Jan 2005 12:32:16 -0500


We use keys for this kind of thing. One can do it using brute force XPath, but this is often not pretty (either as code, or in performance).

In this case, glossary items could be retrieved by name using

<xsl:key match="glossaryitem" use="@name" name="glossaryitems-by-name"/>

So I would write: 'You can then <glossarytt name="Allocate"
width="200">Allocate</glossarytt> resources'

Given this source,

<xsl:template match="glossarytt">
<xsl:apply-templates select="key('glossaryitems-by-name',@name)" mode="tooltip"/>

... the key() function in the select expression retrieves the glossaryitem node that belongs to the matched glossarytt. You could then have a template matching the glossaryitem in mode "tooltip" to generate your tool tip.


At 11:37 AM 1/28/2005, you wrote:
What I want to do is pick up the text from one of the terms and reuse it
elsewhere in the document by referencing just the glossary item "name",
and getting the term and definition as part of a 'tooltip.'

So if the glossary entry is:
<glossaryitem name="Allocate">

<term>Allocate Stuff</term>


<para>Stuff about allocations</para>


And in the document (in another section completely)I write, 'You can then Allocate resources' I want to be able to add a tag that will then pick up the glossaryitem details without me having to retype it.

So I would write: 'You can then <glossarytt name="Allocate"
width="200">Allocate</glossarytt> resources'

When I publish to HTML, the glossarytt tag would request the specific
<glossaryitem> and pick up the <definition>, and format them into a

<a href="#" class="tooltip_Allocate">Allocate<span>Stuff about

The user would then see the text 'You can then Allocate resources' with
Allocate underlined. When they clicked on it they would get a
description of the term.

I can do the tooltips. I can do the glossary. What I can't get it to do
it locate a specific glossary item and then put the definition into the
right place.

Hope that helps...


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

Current Thread