Mike,
Thanks for your nice words. The business rules space is quite large
and there are different tools and languages depending on what you need.
You could probably find a lot of tools if you search using the terms
"rules engine". However, to my limited knowledge, I'm not aware of a
rules language focused solely on XML the same way as XRules.
Your use of the <calculate> rule to replace strings is correct and
it should work just fine. In a future release of XRules there will also
be support for embedding JavaScript functions in the XRules document,
and that will provide another option. Another possibility (but I haven't
tried it) is creating an extended XPath function in your application to
replace the strings and adding it to the XRules Context object. This
should make the DynamicDOM call out to your custom function as needed.
You'll still use the <calculate> rule, but you'll be calling a custom
XPath function to do the string replacement. This, however, seems like
an overkill for what you need. Your method is a lot simpler.
Regards,
Waleed
-----Original Message-----
From: xrules@yahoogroups.com [mailto:xrules@yahoogroups.com] On Behalf
Of mike61079
Sent: Sunday, May 28, 2006 7:47 PM
To: xrules@yahoogroups.com
Subject: [xrules] a thank you and a question about string matching
Hello. I just wanted to say that this is a really great XML rules
library. I had already kind of made my own and then decided as
requests were getting more complicated to do research on what else
was out there. I came across this and it's perfect. It also seems to
work in .NET 2.0 very well which is great! I am surprised this is not
talked about more, it was kind of hard to find. Is there any
comparable W3C spec for doing this? What about comparable
applications? Who else makes something like this? It seems rather
unique as its focus is purely on XML. Which is perfect!
Also I had a usage question. I need to replace certain strings in a
node that match a list or otherwise leave them as they are. So I used
calculate to do that like this:
<xr:calculate target="value">
<xr:value when="value = 'A'">'Apple'</xr:value>
<xr:value when="value = 'B'">'Banana'</xr:value>
<xr:value>value</xr:value>
</xr:calculate>
Is this correct? Is there a better way?