Subject: [xsl] Str:tokenize modification to change the <token> tag From: Naresh Kumar Agarwal <nagarwal@xxxxxxxxxxxxx> Date: Tue, 16 Apr 2002 21:12:17 +0800 |
Hi, I'm new to XSL and need to use XSLT to tokenize, like in Java. I used str:tokenize and it worked (http://www.exslt.org/str/functions/tokenize/) I need to split <description> I am doing good<description> to <desc>I<desc> <desc>am<desc> <desc>doing<desc> <desc>good<desc> Later on, I need to split, <function>a,b,c,d,e<function> to <func>a<func> <func>b<func> <func>c<func> <func>d<func> <func>e<func> Using str:tokenize, I'm getting the result as <token>I<token> <token>am<token> <token>doing<token> <token>good<token> I want to make this "<token>" tag configurable, so that str:tokenize can take it as a parameter. But whenever I try to modify the code (see changes made below) of str:tokenize, I get an illegal character error. How can I modify this <token> tag and pass it as a parameter (like the string and delimiter)? Any help would be greatly appreciated. I need it urgently. Thanks so much, Naresh. <xsl:template name="_tokenize-delimiters"> <xsl:param name="string" /> <xsl:param name="delimiters" /> <!---Begin: my modification--> <xsl:param name="tokentag" select="token" /> <xsl:variable name="start_tag" select="concat('<', $tokentag,'>')" /) <xsl:variable name="end_tag" select="concat('</',$tokentag,'>')" /) <!--End: my modification--> <xsl:variable name="delimiter" select="substring($delimiters, 1, 1)" /> <xsl:choose> <xsl:when test="not($delimiter)"> <!-- commented by me --> <!--<token><xsl:value-of select="$string" /></token>--> <!-- added by me --> <xsl:value-of select="$start_tag" /><xsl:value-of select="$string" /><xsl:value-of select="$end_tag" /> </xsl:when> <xsl:when test="contains($string, $delimiter)"> <xsl:if test="not(starts-with($string, $delimiter))"> <xsl:call-template name="_tokenize-delimiters"> <xsl:with-param name="string" select="substring-before($string, $delimiter)" /> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Using Include File.., Michael Kay | Thread | Re: [xsl] Str:tokenize modification, cutlass |
[xsl] Using Include File.., Ramesh B | Date | Re: [xsl] Str:tokenize modification, cutlass |
Month |