Generating SQL statements in BL

"[email protected]" <[email protected]> Sat, 10 Oct 2009 19:11:31 +0200
Newsgroups gmane.comp.cms.xaraya.devel
Organization Xaraya
Message-ID <[email protected]>
Use case: extending the getitems tag in DD, say for more versatile WHERE 
clauses:

<xar:data-getitems......>
   <where>
     <property name="foo">27</property>
   </where>
</getitems>

Obviously the above is just an example (and a simplified one at that). 
This basically comes out to generating SQL statements from XML. I'm 
wondering whether there is anything out there that could be adopted, in 
terms of XML schemas that represent SQL statements.
I've been trolling around but haven't really found anything much. Since 
this idea presumably is not new, can anyone point me to where I might 
find something along these lines?

Thanks,
Marc