Well, displaying the XSLT code as a concatenation of
Java strings is kind of an odd thing to do, but as far as I can see you've already done what I suggested. There's what looks like the identity transformation at the beginning, and then there's a template which does something with elements which look like <Items type="INOUT">. So that's a good start.
Now, your problem is that you want to drop some <Item> elements which satisfy some condition? Then you write another template which matches <Item> elements. If the element satisifes the condition, then write out the element and inside it you do xsl:apply-templates.
And if I were you I would put that XSLT code into its own file, rather than mixing it up with Java code like that. Easier to maintain, especially having to make sure you do the quotes and apostrophes right.