|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] spliting a string
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






