xsl-list
[Top] [All Lists]

Re: Reusing XML content as I publish

2005-01-28 09:19:53
Tempore 15:04:46, die 01/28/2005 AD, hinc in xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Nicola Harlow <Nicola(_dot_)Harlow(_at_)pm-group(_dot_)com>:

Ok, I want to reuse text that I input into the XML. the output of this
is HTML.
I have a glossary section with glossary terms in it:
Basically I want to reuse that text by getting the XML to search for the
<glossaryitem>, matching the name, and then using the <term> and
<definition> to create a 'tooltip':
<a href="#" class="tooltip_Allocate">Allocate Stuff<span>Stuff about
allocations</span></a>
Note that, in html, the 'class' attribute is interpreted as a space separated list.
So, IMHO, it would be better to use:
class="tooltip Allocate"

I'll use this in the following stylesheet:
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method = "html" indent = "yes"/>

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

<xsl:template match="alphahead">
<h1>
        <xsl:value-of select="."/>
</h1>
</xsl:template>

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

</xsl:stylesheet>

this will output:

<html><body>
<h1>A</h1>
<a href="#" class="tooltip Allocate">Allocate Stuff<span>Stuff about allocations</span></a>
<h1>C</h1>
<a href="#" class="tooltip Commitments">Commitments<span>Text about commitments</span></a>
</body></html>

I'm sorry if this is not an answer to your question. I did not completely understand it.

regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Deserta faciunt et innovationem appelant

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>