Subject: Re: [xsl] Usage of XSLT in the field of text replacement. From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx> Date: Fri, 10 Oct 2008 10:36:35 +0530 |
I think I must share my experience of string manipulation by Perl which will help you people to understand the concept. What we do in Perl is simple as follows:> solution the "temp.ini" file must express the "old" string value as a > regular expression and not a simple string.
expressions. I hope the OP will clarify this.
> If there are sensitive regular expression characters in those values the results may not be > as desired.For this purpose we replace these escape characters within $searchItem. (in this example [ & ] will be replaced by \[ & \]
You are right. My solution assumed that the old strings should be regular expressions. For the example posted by the OP, I had to escape the [ & ] characters. Escaping all possible escape characters could be tedious with my solution.
> Then again, the original poster may want the power of regular expressions inI want to use it as a string not as regular expression. Is something like this kind of concept (<xsl:variable name="regex-pattern" select="tokenize($replacement-data, '|')"/>
> the control file, in which case what you have presented is almost complete,
As suggested by you, the OP could consider having old string values as regular expressions. Then he can reuse most of the code I posted.
I want to explore the usage of XSLT and thinking that upto what extend it is helpful to substitute of Perl. Thanks for the effort done by you, once again!!!> There are so many possible ways to approach the solution based on what the > original poster wanted that I felt his request was unclear.
You are correct. Actually, my intention to post this solution was to showcase, that XSLT 2.0 is capable enough to solve this kind of problem and we can use a facility like, xsl:analyze-string.
I did not intend to write some code, that the OP can use out of the box. He has to finalize certain constraints, and think some ideas of his own too.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Usage of XSLT in the fiel, Mukul Gandhi | Thread | Re: [xsl] Usage of XSLT in the fiel, Mukul Gandhi |
RE: [xsl] Using analyze-string to c, Michael Kay | Date | [xsl] Parameters into variables, Joe Barwell |
Month |