Subject: [xsl] spliting a string From: 04083259@xxxxxxxxxxxxx Date: Fri, 1 Apr 2005 12:32:07 +0100 (BST) |
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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSL-List Guidelines - changed, Mulberry Technologie | Thread | Re: [xsl] spliting a string, David Carlisle |
RE: [xsl] (newby) extraction of CDA, Michael Kay | Date | Re: [xsl] (newby) define an attribu, dalloro |
Month |