The paper presents a criterion of internal correctness of a XSLT program in terms of reachability and productivity with respect to given input DTD. Algorithms are presented that compute reachability and productivity on a fragment of the XSLT language and conservative approximation of these properties for the rest of the XSLT constructs.