|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Usage of XSLT in the field of text replacement.
At 2008-10-09 10:43 +0530, Mukul Gandhi wrote:
Here is a 2.0 solution for this (let's say this file is test.xsl), I think, Mukul, the original poster should be aware that with your proposed solution the "temp.ini" file must express the "old" string value as a regular expression and not a simple string. I think a safer solution would be to use simple substring-before() and substring-after() in recursion ... when I considered what to post as a solution I felt the original poster did not necessarily have control over the "old" string values in the control file. If there are sensitive regular expression characters in those values the results may not be as desired. Then again, the original poster may want the power of regular expressions in the control file, in which case what you have presented is almost complete, but it does not give access to any grouping parentheses when specifying the "new" string value. For example, had you used replace() instead of analyze string the original poster would get access to "$" in the replacement string. There are so many possible ways to approach the solution based on what the original poster wanted that I felt his request was unclear. But if you just look on the face of it, then I think the strings in "temp.ini" are not expected to be regular expressions, in which case the use of either <xsl:analyze-string> or replace() would be out of place for fear of unexpected results. Then again perhaps using a simple replace() to protect the old string and new string by escaping any sensitive regular expression characters brings your solution to the fore again. Determine which characters are regular-expression-sensitive, escape any found in the "old" string and "new" string, and then walk through the string as you have done with <xsl:analyze-string/>. I hope this helps. . . . . . . . . . . . Ken
|
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
|

Cart








