Thank you so much!
Susan
----- Original Message -----
From: "Joris Gillis" <roac(_at_)pandora(_dot_)be>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Sunday, January 09, 2005 3:40 AM
Subject: Re: [xsl] word search a document and eliminate duplicate results
hi,
You could add an expression to the 'xsl:when' that is only true at the
first match:
<xsl:template match="text()" mode="search">
<xsl:param name="term" select="''"/>
<xsl:param name="element" select="''"/>
<xsl:choose>
<xsl:when test="contains(.,$term) and
generate-id()=generate-id(ancestor::p[not(parent::note)][1]//text()[contains(.,$term)])">
<xsl:apply-templates
select="ancestor::p[not(parent::note)][1]"/>
<hr/><br/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
You might also avoid the duplication by copying at the top rather than
after diving in the tree. e.g.:
<xsl:template match="/">
<div>
<xsl:for-each
select="/*/*[local-name()=document('')/*/xsl:variable[(_at_)name='select-elements']/item][contains(.,$target1)]">
<xsl:copy-of select="."/>
<hr/>
</xsl:for-each>
</div>
</xsl:template>
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Vincit omnia simplicitas
Keep it simple
--~------------------------------------------------------------------
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>
--~--