hi
i have the following template which splits a string to tokens elements
when ever a delimiter occurs :
<xsl:template name="tokenizer">
<xsl:param name="string" />
<xsl:param name="delimiter" select="' '" />
<xsl:choose>
<xsl:when test="$delimiter and contains($string, $delimiter)">
<token> <xsl:value-of
select="substring-before($string,$delimiter)" /> </token>
<xsl:call-template name="tokenizer">
<xsl:with-param name="string"
select="substring-after($string,$delimiter)" />
<xsl:with-param name="delimiter" select="$delimiter" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<token> <xsl:value-of select="$string" /></token>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
if we run the above template over the following string :
i have 22xxxxx+10 elements in my database+10yyyyyy attribute for each
we get the following result:
<token>i</token>
<token>have</token>
<token>22xxxxx+10</token>
<token>elements</token>
<token>in</token>
<token>my</token>
<token>database+10yyyyyy</token>
<token>attribute</token>
<token>for</token>
<token>each</token>
i am trying to split the string further where it finds the ( +) and
where it finds (xxxxx) and where it finds (yyyyy)
so a substring which has a (+) has to return with the substring just
after it as one token element
so the result that i am struggling to achieve is the following :
<token>i</token>
<token>have</token>
<token>22</token>
<token>xxxxx</token>
<token>+10</token>
<token>elements</token>
<token>in</token>
<token>my</token>
<token>database+10</token>
<token>+10</token>
<token>yyyyyy</token>
<token>attribute</token>
<token>for</token>
<token>each</token>
--~------------------------------------------------------------------
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>
--~--