All XSLT stylesheets are themselves XML documents, so all the rules of XML documents apply to all stylesheets you write.
An XML document must be contained in a single element
The first element in your XML document must contain the entire document. That first element is called the document element or the root element.
All elements must be nested
If you start one element inside another, you have to end it there, too.
All attributes must be quoted
You can quote the attributes with either single or double quotes.These two XML tags are equivalent:
<a href="http://www.google.com">
<a href='http://www.google.com'>
Also XML doesn’t allow attributes without values.
XML tags are case-sensitive
In HTML, <h1> and <H1> are the same. In XML, they’re not. If you try to end an <h1> element with </H1>, the parser will throw an exception.
All end tags are required
This is another area where most HTML documents break. Your browser doesn’t care whether you don’t have a </p> or </br> tag, but your XML parser does.
Empty tags can contain the end marker
In other words, these two XML fragments are identical:
<lily age="13"></lily>
<lily age="13"/>
Notice that there is nothing, not even whitespace, between the start tag and the end tag in the first example; that’s what makes this an empty tag.
XML declarations
Some XML documents begin with an XML declaration, which is a line similar to this:
<?xml version="1.0" encoding="ISO-8859-1"?>
If no encoding is specified, the XML parser assumes you’re using UTF-8 or UTF-16.