If you link to an XSLT file using a style sheet processing instruction, that instruction needs to be at the beginning of an XML document, following the XML declaration (if there is one) and the document type declaration (if there is one). For example, the style sheet processing instruction needs to appear just after <?xml version ="1.0"?>
in the Sample XML File (books.xml), as shown in bold in the following document fragment:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="books.xsl" ?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
</book>
....
</catalog>
Processing Instructions | Linking to an XSLT File | Linking Using the DOM
W3C Associating Style Sheets with XML Documents, Version 1.0