How to make and apply rules dynamically?



Hi,

I am trying make rules in the program dynamically from a pre-defined list
and applying all the rules one by one to the input expression.
e.g. I have predefined list: [x(I,L) = r(L), x(I, L)*x(J, K)) = r(L)*d(L,
K),.....]
Now when there is an input expression like
sum(x(t,u)*y(t),t,1,n)*sum(x(e,f)*x(g,h)*z(h),h,1,n); I need to first
search from the predefined list what to apply on the expression and then
make rules accordingly from them and then at the end apply all the rules
made.

I have been able to figure out what rule to apply from the list. I now
know how to apply rule on the expression. But for handling dynamic thingie
I have following problems:
1) How to define rule names dynamically.
2) How to apply rules using apply1 passing it the LIST of rules. Since we
don?t know how many rules will be there. Should I use the loop to do that?

Regards
Dileep