'.classa > .classb'
should be: 'descendant-or-self::*[contains(concat(" ",@class," ")," classa ")]/*[contains(concat(" ",@class," ")," classb ")]'
edit: corrected on 2015-08-26
changing
$selector = str_replace(']/*', ']', $selector);
to
$selector = str_replace(']/*[position', '][position', $selector);
fixes the issue and passes regression testing