home *** CD-ROM | disk | FTP | other *** search
/ MacFormat UK 160 - Disc 2 / MF_UK_160_2.iso / pc / DiscContent / Trials / oxygen / samples / fxsl / testFunc-spell.xsl < prev   
Encoding:
Extensible Markup Language  |  2005-07-21  |  1.4 KB  |  39 lines

  1. <xsl:stylesheet version="2.0"
  2.  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4.  xmlns:f="http://fxsl.sf.net/"
  5.  exclude-result-prefixes="f xs"
  6.  >
  7.  <xsl:import href="../../frameworks/fxsl/f/func-getWords.xsl"/>
  8.  <xsl:import href="../../frameworks/fxsl/f/func-Spell.xsl"/>
  9.   
  10.   <xsl:output omit-xml-declaration="yes"/>
  11.  
  12.  <xsl:variable name="vDelim" as="xs:string"> ,‚Äî:.- !?;</xsl:variable>
  13.  
  14.  <!-- To be applied on othello.xml from the frameworks/fxsl/data directory--> 
  15.   <xsl:template match="/">
  16.     <xsl:variable name="vwordNodes" as="element()*">
  17.        <xsl:for-each select="//text()/lower-case(.)">
  18.          <xsl:sequence select="f:getWords(., $vDelim, 1)"/>
  19.        </xsl:for-each>
  20.     </xsl:variable>
  21.     
  22.     <xsl:variable name="vUnique" as="xs:string+">
  23.       <xsl:perform-sort select="distinct-values($vwordNodes)">
  24.         <xsl:sort select="."/>
  25.       </xsl:perform-sort>
  26.     </xsl:variable>
  27.     
  28.     <xsl:variable name="vnotFound" as="xs:string*"
  29.      select="$vUnique[not(f:spell(.))]"/>
  30.  
  31.     <xsl:value-of separator=" "
  32.      select="$vnotFound"/>
  33.   
  34.     A total of <xsl:value-of select="count($vwordNodes)"/> words 
  35.     were spelt, (<xsl:value-of select="count($vUnique)"/>) distinct.
  36.     
  37.     <xsl:value-of select="count($vnotFound)"/> not found.
  38.  </xsl:template>
  39. </xsl:stylesheet>