This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Counting Word Occurences



  <xsl:variable name="text" select="div/abstract"/>
  <xsl:if test="contains($text, $keyword)">

If you do that, then text is a node set containing each of the abstract
nodes, and when you use a node set in a string context then you get the
string value of the first node in the set.

  <xsl:variable name="text">
   <xsl:copy-of select="div/abstract"/>
  </xsl:variable>
  <xsl:if test="contains($text, $keyword)">

now text is an rtf (or node set in xslt 1.1) with just a single root
node and child abstract nodes. So now when used in a string context
you get the string value of the root node, ie th estring value of all the 
children.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]