Re: [xsl] Reusing XML content as I publish

Subject: Re: [xsl] Reusing XML content as I publish
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Fri, 28 Jan 2005 17:59:56 +0100
Tempore 17:37:18, die 01/28/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Nicola Harlow <Nicola.Harlow@xxxxxxxxxxxx>:

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 you want to create:
You can then <a href="#" class="tooltip Allocate">Allocate Stuff<span>Stuff about allocations</span></a> resources

from input xml:
<glossaryitem name="Allocate">
	<term>Allocate Stuff</term>
		<para>Stuff about allocations</para>
You can then <glossarytt name="Allocate"
width="200">Allocate</glossarytt> resources

That can easily be done with a 'key':

<xsl:stylesheet xmlns:xsl = ""; version="1.0">
<xsl:output method = "html" indent = "yes"/>

<xsl:key name="glossary" match="glossaryitem" use="@name"/>

<xsl:template match="/">
		<xsl:apply-templates select="root/body"/>

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

<xsl:template match="glossaryitem">
<a href="#" class="tooltip {@name}">
	<xsl:value-of select="term"/>
		<xsl:apply-templates select="definition"/>


I hope I got it right now...

regards, -- Joris Gillis ( Deserta faciunt et innovationem appelant

Current Thread