[Home] [By Thread] [By Date] [Recent Entries]
I have a simple template, see below:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="node">
<div style="text-indent:{count(ancestor-or-self::node)*2}em">
<xsl:value-of select="name"/>
</div>
<br/>
<xsl:apply-templates select="node"/>
</xsl:template>
</xsl:stylesheet>that takes a nodeset such as the following: <node>
<id>123456789</id>
<name>COMPANY ABC</name>
<node>
<id>456789123</id>
<name>COMPANY<exist:match>XYZ</exist:match></name>
</node>
</node>and simply lists the names, indented corresponding to their nested level. In the example above the list would simply be: COMPANY ABC
COMPANY XYZWhat my problem is that I would like to add a template of the form: <xsl:template match="exist:match">
<span style="background-color: #FFFF00">
???
</span>
</xsl:template>to the above stylesheet so as to "highlight" in color the term tagged in the nodeset with <exist:match>. How would I integrate this template and what would I specify for ??? to accomplish this? All the variations that I have tried do nothing (I can get highlighting but am not able to maintain the indent in the output), but as a newcomer to XSLT I've probably missed something obvious. Could someone please point me in the right direction? Thank you.
|

Cart



