Subject: strSplit-to-Words.xsl
From: Ali Choumane <ali.choumane@xxxxxxx>
Date: Wed, 27 Apr 2005 18:27:45 +0200
|
Hi Dimitre,
In the approach you provided last time, there is an imoprt:
<xsl:import href="/sgml/fxsl/strSplit-to-Words.xsl"/>
but I can't find the file "strSplit-to-Words.xsl" ??
thanks,
Quoting Dimitre Novatchev <dnovatchev@xxxxxxxxx>:
> Hi Dave,
>
> Please, note that the str-split-to-words template generally handles *a
> set* of delimiters, not just one delim character.
>
> Therefore, one can set the pDelimiters parameters say to:
>
> " ,;?\!"
>
> and it will retrieve words that are delimited by any pair of these.
>
> On the other side, if I understand well the code of the tokens
> template provided by you, it checks always for a single delimiter
> string.
>
>
> Cheers,
>
> Dimitre.
>
> On 4/20/05, Pawson, David <David.Pawson@xxxxxxxxxxx> wrote:
> > Following up on a converstation I had with Jarno and Dimitre.
> > This is a New York version of tokenize. (So good we did it twice)
> >
> > General purpose tokenize, for known delimiters.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:f="http://fxsl.sf.net/"
> > exclude-result-prefixes="f">
> >
> > <xsl:import href="/sgml/fxsl/strSplit-to-Words.xsl"/>
> > <xsl:output method="xml"
> > encoding="UTF-8" indent="yes"/>
> >
> > <xsl:template match="/vs">
> > <xsl:value-of select="system-property('xsl:product-version')" />
> >
> > <xsl:apply-templates />
> > </xsl:template>
> >
> > <xsl:variable name="xxx" select="//fld[1]"/>
> >
> > <xsl:template match="line">
> > <xsl:call-template name="tokens">
> > <xsl:with-param name="str" select="@event"/>
> > <xsl:with-param name="splitString" select="' '"/>
> > </xsl:call-template>
> > And using fxsl
> > <xsl:call-template name="str-split-to-words">
> > <xsl:with-param name="pStr" select="@event"/>
> > <xsl:with-param name="pDelimiters" select="' '"/>
> > </xsl:call-template>
> > </xsl:template>
> >
> > <xsl:template name="tokens">
> > <xsl:param name="str" select="."/>
> > <xsl:param name="splitString" select="' '"/>
> > <xsl:choose>
> > <xsl:when test="contains($str,$splitString)">
> > <token>
> > <xsl:value-of select="substring-before($str,$splitString)"/>
> > </token>
> > <xsl:call-template name="tokens">
> > <xsl:with-param name="str"
> select="substring-after($str,$splitString)"/>
> > <xsl:with-param name="splitString" select="$splitString"/>
> > </xsl:call-template>
> > </xsl:when>
> > <xsl:otherwise>
> > <token><xsl:value-of select="$str"/></token>
> > </xsl:otherwise>
> > </xsl:choose>
> > </xsl:template>
> >
> > <xsl:template match="vs">
> > <xsl:apply-templates/>
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> > Input
> >
> > <?xml version="1.0" ?>
> > <vs>
> > <line event="x y x">
> > </line>
> >
> > </vs>
> >
> > output
> >
> > c:\sgml>type op.xml
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <token>x</token>
> > <token>y</token>
> > <token>x</token>
> > And using fxsl
> > <word>x</word>
> > <word>y</word>
> > <word>x</word>
> >
> > HTH DaveP
> >
> > --
> > DISCLAIMER:
> >
> > NOTICE: The information contained in this email and any attachments is
> > confidential and may be privileged. If you are not the intended
> > recipient you should not use, disclose, distribute or copy any of the
> > content of it or of any attachment; you are requested to notify the
> > sender immediately of your receipt of the email and then to delete it
> > and any attachments from your system.
> >
> > RNIB endeavours to ensure that emails and any attachments generated by
> > its staff are free from viruses or other contaminants. However, it
> > cannot accept any responsibility for any such which are transmitted.
> > We therefore recommend you scan all attachments.
> >
> > Please note that the statements and views expressed in this email and
> > any attachments are those of the author and do not necessarily represent
> > those of RNIB.
> >
> > RNIB Registered Charity Number: 226227
> >
> > Website: http://www.rnib.org.uk
>
>
Ali CHOUMANE
M2R III ,Univ Joseph fourrier, UFR IMA
WAM/INRIA & GETA/CLIPS
portable. 06 71 55 80 65
Bureau(INRIA). 04 76 61 54 13
Email. ali.choumane@xxxxxxx
-------------------------------------------------
envoyi via Webmail/IMAG !
|