XSD is an acronym for eXtensible Schema Document. A XML schema is similar to a DTD, but allows more flexibility and precision in structure specification.

<?xml version="1.0"?> <xsd:schema> <xsd:element name="tasks"> <xsd:complexType> <xsd:element name="task" maxOccurs="unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name="date" type="xsd:date" /> <xsd:element name="initials" type="xsd:string" /> <xsd:element name="detail" type="xsd:string" /> </xsd:sequence> <xsd:attribute name="rrn" type="xsd:int" use="required"/> </xsd:complexType> </xsd:element> </xsd:schema>

This is an XML schema for the XML file above.



The structure of an XSL file is that of a standard XML file, with the addition of some possibly specialised parts. The structure will be as follows.

  • XML Prologue
  • xsl:stylesheet

XML Prologue

An XSL file is a standard XML file and thus starts with a standard XML prologue.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


The top level element of a schema is the xsd:schema element, which must be defined with the namespace prefix pointing to "http://www.w3.org/2001/XMLSchema".


The following code shows a valid schema declaration.

<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- content --> </xsd:schema>