I think I would do this using components.
If each WeBWorK exercise currently begins with an exercise tag that has an xml:id identifying it as WeBWorK, this can be done quickly.
If you have a pattern like
<exercise xml:id="ex-ww-foo">, you can do a global find-replace to replace
<exercise xml:id="ex-ww-foo"> with
<exercise xml:id="ex-ww-foo" component="webwork">
This can be done in one step using regular expressions.
You can also do it if the pattern is like
<exercise>
<webwork>
but being the regex right is slightly harder.
Then these should not show up unless you have include="webwork" at the right point in your publisher file.
for details on using components.