|
Subject: Re: Linking acronym to a glossary entry From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 31 Aug 1999 11:06:14 -0400 |
given
<p>blah <acronym>RNIB</acronym> blah </p>
....
<glossary> <term>RNIB</term><defn> Royal </defn> ....
</glossary>
is it possible to create a link between the use of the acronym in the p element and the term element in the glossary?
I'm OK using generate-id() on the glossary term, but I'm stuck on generating the <a href contents .... I (think I) need to 1. find the matching term (with what construct?)
2. then use generate-id(.)
T:\dave>type test.xml <?xml version="1.0"?> <test> <body> <p>blah <acronym>RNIB</acronym> blah </p> </body>
<glossary>
<def><term>RNIB</term><defn> Royal </defn></def>
<def><term>XSLT</term>
<defn> <acronym>XSL</acronym> Transformations</defn></def>
<def><term>XSL</term><defn>Extensible Stylesheet Language</defn></def>
</glossary>
</test>
T:\dave>type test.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"><xsl:template match="p|def"> <p><xsl:apply-templates/></p> </xsl:template>
<xsl:template match="acronym"> <!--find term with same content as acro-->
<a href="#{generate-id(//def/term[.=current()])}">
<xsl:value-of select="."/>
</a>
</xsl:template><xsl:template match="term">
<a name="{generate-id(.)}"><b><xsl:value-of select="."/></b>: </a>
</xsl:template>
T:\dave>call xsl test.xml test.xsl test.htm T:\dave>type test.htm
<p><a name="N15"><b>RNIB</b>: </a> Royal </p>
<p><a name="N21"><b>XSLT</b>: </a>
<a href="#N31">XSL</a> Transformations</p>
<p><a name="N31"><b>XSL</b>: </a>Extensible Stylesheet Language</p>-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Website: XSL/XML/DSSSL/SGML services, training, libraries, products. Practical Transformation Using XSLT and XPath ISBN 1-894049-01-2 Next instructor-led training: MT'99 1999-12-05/06
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Linking acronym to a glossary entry, DPawson | Thread | Matching empty tags, Araquel, Ed E. |
| Linking acronym to a glossary entry, DPawson | Date | Matching empty tags, Araquel, Ed E. |
| Month |