right on guys, thanks a bunch.
Cheers,
Spencer
On 5/9/07, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
$ saxon8 hit.xml hit.xsl search=foo
<?xml version="1.0" encoding="UTF-8"?><root>
<text>This is <font color="blue"><a hit="1"/>foo</font></text>
<element>
<sub>This is another <font color="blue"><a hit="2"/>foo</font><br/> and yet more <font
color="blue"><a hit="3"/>foo</font> galore</sub>
</element>
</root>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="search" select="''"/>
<xsl:template match="/">
<xsl:variable name="x">
<xsl:apply-templates/>
</xsl:variable>
<xsl:apply-templates mode="b" select="$x"/>
</xsl:template>
<xsl:template match="*" mode="#default b">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="#current"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()[contains(., $search)]">
<xsl:analyze-string select="." regex="{$search}(s|ing){{0,1}}">
<xsl:matching-substring>
<font color="blue"><a><hit/></a><xsl:value-of
select="."/></font>
</xsl:matching-substring>
<xsl:non-matching-substring><xsl:value-of
select="."/></xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>
<xsl:template match="hit" mode="b">
<xsl:attribute name="hit">
<xsl:number level="any"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--