<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="template">
		<xs:complexType mixed="true">
			<xs:sequence>
				<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
				<xs:element name="id" minOccurs="1" maxOccurs="1">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:pattern value="[a-zA-Z0-9_-]{3,25}"/>
							<xs:whiteSpace value="preserve"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="authorName" type="xs:string" minOccurs="1" maxOccurs="1"/>
				<xs:element name="authorEmail" type="xs:string" minOccurs="1" maxOccurs="1"/>
				<xs:element name="authorUrl" type="xs:anyURI" minOccurs="0" maxOccurs="1"/>
				<xs:element name="copyright" type="xs:string" minOccurs="1" maxOccurs="1"/>
				<xs:element name="license" type="xs:string" minOccurs="1" maxOccurs="1"/>
				<xs:element name="creationDate" type="xs:date" minOccurs="1" maxOccurs="1"/>
				<xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1"/>
				<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
				<xs:element name="previewImage" type="xs:string" minOccurs="0" maxOccurs="1"/>
				<xs:element name="language" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="file" maxOccurs="unbounded">
								<xs:complexType>
									<xs:simpleContent>
										<xs:extension base="langFile">
											<xs:attribute name="lang" use="required">
												<xs:simpleType>
													<xs:restriction base="xs:string">
														<xs:pattern value="[a-z]{2}_[A-Z]{2}"/>
														<xs:whiteSpace value="preserve"/>
													</xs:restriction>
												</xs:simpleType>
											</xs:attribute>
											<xs:attribute name="admin" default="false"/>
										</xs:extension>
									</xs:simpleContent>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
						<xs:attribute name="folder" use="optional"></xs:attribute>
					</xs:complexType>
				</xs:element>
				<xs:element name="files" minOccurs="0" maxOccurs="1">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="file" maxOccurs="unbounded">
								<xs:complexType>
									<xs:simpleContent>
										<xs:extension base="xs:string">
											<xs:attribute name="path" use="required" type="xs:string"/>
										</xs:extension>
									</xs:simpleContent>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="exec" minOccurs="0" maxOccurs="1">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:pattern value="[a-zA-Z0-9]{3,50}\.php"/>
							<xs:whiteSpace value="preserve"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="requirements" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:choice minOccurs="0" maxOccurs="unbounded">
							<xs:element name="core" type="requirement" minOccurs="0" maxOccurs="1"/>
							<xs:element name="application" type="requirement" minOccurs="0" maxOccurs="unbounded"/>
							<xs:element name="field" type="requirement" minOccurs="0" maxOccurs="unbounded"/>
							<xs:element name="php" type="requirement" minOccurs="0" maxOccurs="unbounded"/>
						</xs:choice>
					</xs:complexType>
				</xs:element>
				<xs:element name="install" minOccurs="0" maxOccurs="1">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="section" minOccurs="0" maxOccurs="1">
								<xs:complexType>
									<xs:all>
										<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
										<xs:element name="description" type="xs:string" minOccurs="1" maxOccurs="1"/>
										<xs:element name="sfMetaDesc" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="sfMetaKeys" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="efMetaDesc" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="efMetaKeys" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="efTitle" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="sfTitle" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="efDesc" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="sfDesc" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="metaDesc" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="metaKeys" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="metaAuthor" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="metaRobots" type="xs:string" minOccurs="0" maxOccurs="1"/>
										<xs:element name="nameField" type="xs:string" minOccurs="1" maxOccurs="1"/>
										<!-- for legacy, will be removed if all templates are updated  -->
										<xs:element name="showTopMenu" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
										<xs:element name="catsInLine" type="xs:int" minOccurs="0" maxOccurs="1"/>
										<xs:element name="showCategoryDesc" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
										<xs:element name="showCategoryMeta" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
										<xs:element name="showCategoryFull" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
										<xs:element name="showCategorySubcats" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
										<xs:element name="entriesInLine" type="xs:int" minOccurs="0" maxOccurs="1"/>
										<xs:element name="entriesOnPage" type="xs:int" minOccurs="0" maxOccurs="1"/>
										<xs:element name="showEntryMeta" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
										<xs:element name="showEntryCategories" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
										<!-- for legacy, will be removed if all templates are updated  -->
										<xs:element name="options" minOccurs="0" maxOccurs="1">
											<xs:complexType>
												<xs:choice maxOccurs="unbounded">
													<xs:element name="option" maxOccurs="unbounded">
														<xs:complexType>
															<xs:simpleContent>
																<xs:extension base="xs:string">
																	<xs:attribute name="attribute" use="required" type="xs:string"/>
																</xs:extension>
															</xs:simpleContent>
														</xs:complexType>
													</xs:element>
												</xs:choice>
											</xs:complexType>
										</xs:element>
										<xs:element name="settings" minOccurs="0" maxOccurs="1">
											<xs:complexType>
												<xs:choice maxOccurs="unbounded">
													<xs:element name="setting" maxOccurs="unbounded">
														<xs:complexType>
															<xs:simpleContent>
																<xs:extension base="xs:string">
																	<xs:attribute name="section" use="required" type="xs:string"/>
																	<xs:attribute name="key" use="required" type="xs:string"/>
																	<xs:attribute name="value" use="required" type="xs:string"/>
																</xs:extension>
															</xs:simpleContent>
														</xs:complexType>
													</xs:element>
												</xs:choice>
											</xs:complexType>
										</xs:element>
										<xs:element name="fields" minOccurs="0" maxOccurs="1">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="field" maxOccurs="unbounded">
														<xs:complexType>
															<xs:sequence>
																<xs:element name="name" minOccurs="1" maxOccurs="1">
																	<xs:simpleType>
																		<xs:restriction base="xs:string">
																			<xs:pattern value="field_[a-zA-Z0-9_]{2,50}"/>
																			<xs:whiteSpace value="preserve"/>
																		</xs:restriction>
																	</xs:simpleType>
																</xs:element>
																<xs:element name="label" minOccurs="1" maxOccurs="1">
																	<xs:complexType>
																		<xs:simpleContent>
																			<xs:extension base="xs:string">
																				<xs:attribute name="lang" use="optional" type="xs:string" default="en-GB"/>
																			</xs:extension>
																		</xs:simpleContent>
																	</xs:complexType>
																</xs:element>
																<xs:element name="type" type="xs:string" minOccurs="1" maxOccurs="1"/>
																<xs:element name="required" minOccurs="1" maxOccurs="1" type="xs:boolean"/>
																<xs:element name="showIn" minOccurs="0" maxOccurs="1" default="both">
																	<xs:simpleType>
																		<xs:restriction base="xs:string">
																			<xs:enumeration value="both"/>
																			<xs:enumeration value="details"/>
																			<xs:enumeration value="vcard"/>
																			<xs:enumeration value="hidden"/>
																		</xs:restriction>
																	</xs:simpleType>
																</xs:element>
																<xs:element name="adminField" minOccurs="0" maxOccurs="1">
																	<xs:simpleType>
																		<xs:restriction base="xs:string">
																			<xs:enumeration value="false"/>
																			<xs:enumeration value="true"/>
																			<xs:enumeration value="-1"/>
																		</xs:restriction>
																	</xs:simpleType>
																</xs:element>
																<xs:element name="options" minOccurs="0" maxOccurs="1">
																	<xs:complexType>
																		<xs:choice maxOccurs="unbounded">
																			<xs:element name="option" maxOccurs="unbounded">
																				<xs:complexType>
																					<xs:simpleContent>
																						<xs:extension base="xs:string">
																							<xs:attribute name="attribute" use="required" type="xs:string"/>
																						</xs:extension>
																					</xs:simpleContent>
																				</xs:complexType>
																			</xs:element>
																			<xs:element name="values" maxOccurs="unbounded">
																				<xs:complexType>
																					<xs:sequence>
																						<xs:element name="value" maxOccurs="unbounded">
																							<xs:complexType>
																								<xs:simpleContent>
																									<xs:extension base="xs:string">
																										<xs:attribute name="name" use="optional" type="xs:string"/>
																										<xs:attribute name="group" use="optional" type="xs:string"/>
																										<xs:attribute name="lang" use="optional" type="xs:string"/>
																										<xs:attribute name="label" use="optional" type="xs:string"/>
																										<xs:attribute name="size" use="optional" type="xs:string"/>
																										<xs:attribute name="width" use="optional" type="xs:string"/>
																										<xs:attribute name="height" use="optional" type="xs:string"/>
																										<xs:attribute name="enabled" use="optional" type="xs:boolean"/>
																										<xs:attribute name="nid" use="optional" type="xs:string"/>
																										<xs:attribute name="type" use="optional" type="xs:string"/>
																										<xs:attribute name="position" use="optional" type="xs:int"/>
																										<xs:attribute name="params" use="optional" type="xs:string"/>
																										<xs:attribute name="parent" use="optional" type="xs:string"/>
																									</xs:extension>
																								</xs:simpleContent>
																							</xs:complexType>
																						</xs:element>
																					</xs:sequence>
																					<xs:attribute name="attribute" use="optional" type="xs:string"/>
																				</xs:complexType>
																			</xs:element>
																		</xs:choice>
																	</xs:complexType>
																</xs:element>
																<xs:element name="specific" minOccurs="0" maxOccurs="1">
																	<xs:complexType>
																		<xs:sequence>
																			<xs:element name="data" minOccurs="0" maxOccurs="unbounded">
																				<xs:complexType>
																					<xs:simpleContent>
																						<xs:extension base="xs:string">
																							<!--<xs:attribute name="name" use="optional" type="xs:string" />-->
																							<xs:anyAttribute processContents="skip"/>
																						</xs:extension>
																					</xs:simpleContent>
																				</xs:complexType>
																			</xs:element>
																		</xs:sequence>
																	</xs:complexType>
																</xs:element>
															</xs:sequence>
														</xs:complexType>
													</xs:element>
												</xs:sequence>
											</xs:complexType>
										</xs:element>
										<xs:element name="categories" minOccurs="0" maxOccurs="1">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="category" maxOccurs="unbounded">
														<xs:complexType>
															<xs:complexContent>
																<xs:extension base="category"/>
															</xs:complexContent>
														</xs:complexType>
													</xs:element>
												</xs:sequence>
											</xs:complexType>
										</xs:element>
									</xs:all>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="category">
		<xs:sequence>
			<xs:element name="name" minOccurs="1" maxOccurs="1">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:minLength value="2"/>
						<xs:maxLength value="100"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="alias" minOccurs="0" maxOccurs="1" type="xs:string"/>
			<xs:element name="introtext" minOccurs="0" maxOccurs="1" type="xs:string"/>
			<xs:element name="description" minOccurs="0" maxOccurs="1" type="xs:string"/>
			<xs:element name="icon" minOccurs="0" maxOccurs="1" type="xs:string"/>
			<xs:element type="xs:byte" name="showIcon" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:byte" name="showIntrotext" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:byte" name="parseDesc" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:byte" name="state" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:string" name="metaDesc" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:string" name="metaKeys" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:string" name="metaAuthor" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:string" name="metaRobots" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:string" name="entryFields" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:byte" name="allFields" minOccurs="0" maxOccurs="1"/>
			<xs:element type="xs:string" name="params" minOccurs="0" maxOccurs="1"/>
			<xs:element name="fields" minOccurs="0">
				<xs:complexType mixed="true">
					<xs:sequence minOccurs="0" maxOccurs="unbounded">
						<xs:any processContents="skip" minOccurs="0"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<!-- options does not exist in category ?? -->
			<xs:element name="options" minOccurs="0" maxOccurs="1">
				<xs:complexType>
					<xs:choice maxOccurs="unbounded">
						<xs:element name="option" maxOccurs="unbounded">
							<xs:complexType>
								<xs:simpleContent>
									<xs:extension base="xs:string">
										<xs:attribute name="attribute" use="required" type="xs:string"/>
									</xs:extension>
								</xs:simpleContent>
							</xs:complexType>
						</xs:element>
					</xs:choice>
				</xs:complexType>
			</xs:element>
			<xs:element name="childs" minOccurs="0" maxOccurs="1">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="category" maxOccurs="unbounded">
							<xs:complexType>
								<xs:complexContent>
									<xs:extension base="category"/>
								</xs:complexContent>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="requirement" mixed="true">
		<xs:attribute name="version" use="optional">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:pattern value="(\d+\.)?(\d+\.)?(\d+)?(\.)?(\d+)?"/>
					<xs:whiteSpace value="preserve"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
		<xs:attribute name="type" use="optional">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:pattern value="function|class"/>
					<xs:whiteSpace value="preserve"/>
				</xs:restriction>
			</xs:simpleType>
		</xs:attribute>
	</xs:complexType>
	<xs:simpleType name="langFile">
		<xs:restriction base="xs:string">
			<xs:pattern value="[a-zA-Z0-9\.\-_]{3,100}\.(ini|mo|po)"/>
			<xs:whiteSpace value="preserve"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
