Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XSL Replace Function

843834Oct 4 2008 — edited Oct 8 2008
Hi all

I'm trying to convert an xml document from one format to another format.I'm writing a stylesheet for this.I'm kind of new to XSLT.What I want is to replace a string with another only if exact match occurs for eg:
if i'm looking for the string "input" in the document it should replace only input variable in the following string but not "input_array".

<function_code>

y = input_array[0];
yp = 0;
time_previous = time_array[0];
result_array[0] = y;

for (int i = 1; i < channel_size; ++i) {
double input = input_array;
double time = time_array[i];

double h = time - time_previous;
double k = h/2.0;
double A = k*(omega_sq*input - 2*zeta*omega*yp - omega_sq*y); //k*calculate_ypp( time, y, yp, input );

double Beta = k*(yp + A/2.0);
double B = k*(omega_sq*input - 2*zeta*omega*(yp+A) - omega_sq*(y+Beta)); //B = k*calculate_ypp(time+k, y+Beta, yp+A, input);
double C = k*(omega_sq*input - 2*zeta*omega*(yp+B) - omega_sq*(y+Beta)); //C = k*calculate_ypp(time+k, y+Beta, yp+B, input);

result_array[i] = C;
} </function__code>

,the replace function XSLT provides replaces all occurrences of input i.e input followed by anything.Is there a way to do it??

thanks for your time and valuable inputs.
Sree
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 5 2008
Added on Oct 4 2008
3 comments
404 views