Do you want to use XSLT 2.0 or 1.0? With 2.0 you can use xsl:analyze-string e.g.
Code:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xsd"
version="2.0">
<xsl:param name="term" as="xsd:string" select="'Ordinance'"/>
<xsl:param name="col" as="xsd:string" select="'red'"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="footnote">
<div>
<xsl:variable name="pattern"
as="xsd:string"
select="concat('(^|\s+|[,.!?])(', $term, ')(\s+|[,.!?]|$)')"/>
<xsl:analyze-string select="." regex="{$pattern}">
<xsl:matching-substring>
<xsl:value-of select="regex-group(1)"/>
<span style="color: red;">
<xsl:value-of select="regex-group(2)"/>
</span>
<xsl:value-of select="regex-group(3)"/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</div>
</xsl:template>
</xsl:stylesheet>
would output the 'footnote' elements as
Code:
<div>1. The first Companies <span style="color: red;">Ordinance</span> having force in the territories which eventually
</div>
<div>2. The ..territories which eventually</div>
<div>3. The first Companies having force in the territories which eventually</div>
<div>4. The first Companies having force in the territories which eventually</div>