Subject: RE: [xsl] Reusing XML content as I publish From: "Nicola Harlow" <Nicola.Harlow@xxxxxxxxxxxx> Date: Mon, 31 Jan 2005 12:58:23 -0000 |
Hi Wendell, Thank you very much, that looks to be exactly what I need :) Although what I really need is training in XML... maybe next financial year ;) Thanks again, Nicola -----Original Message----- From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx] Sent: 28 January 2005 17:32 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Reusing XML content as I publish Nicola, 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"/> </xsl:template> ... 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. Cheers, Wendell 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> > > <definition> > > <para>Stuff about allocations</para> > > </definition> > > >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 >tooltip: > ><a href="#" class="tooltip_Allocate">Allocate<span>Stuff about >allocations</span></a> > >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... > >Nicola ====================================================================== 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Reusing XML content as I , Wendell Piez | Thread | [xsl] namespace reference in xsl wi, Karjala Koponen |
[xsl] Grouping immediate follow sib, Paul Clarke | Date | [xsl] from start tag A to end tag B, Robert Soesemann |
Month |