My first suggestion would be for you to generate a minimal XML document containing a couple of elements
- one which passes the tests (as you understand it)
- one which fails the tests

Or take an existing document and make a copy of it, containing just a few representative elements.

Does applying your xslt to that document produce the result you want?