<?xml version="1.0"?>
<syntax name="language-root.xml.svg">
	<zones>
		<!-- Script, style, and doctype tag handling pilfered from HTML syntax -->
		
		<zone name="tag.doctype.xml">
			<starts-with>
				<expression>(&lt;!)(?i:DOCTYPE)</expression>
				<capture number="1" name="punctuation.definition.begin"/>
				<capture number="2" name="entity.name"/>
			</starts-with>
			<ends-with>
				<expression>></expression>
				<capture number="0" name="punctuation.definition.end"/>
			</ends-with>
		</zone>
		
		<!-- Embedded styles -->
		<zone name="embedded-style.svg">
			<starts-with>
				<expression>(?=&lt;(?i:style))</expression>
			</starts-with>
			<ends-with>
				<expression>(&lt;/)((?i:style))(>)</expression>
				<capture number="0" name="tag.close.style.xml"/>
				<capture number="1" name="punctuation.definition"/>
				<capture number="2" name="entity.name"/>
				<capture number="3" name="punctuation.definition"/>
			</ends-with>
			<subzones>
				<zone name="tag.open.style.xml">
					<starts-with>
						<expression>(&lt;)((?i:style))</expression>
						<capture number="1" name="punctuation.definition.begin"/>
						<capture number="2" name="entity.name"/>
					</starts-with>
					<ends-with>
						<expression>(/?)(>)</expression>
						<capture number="1" name="punctuation.definition.self-closing"/>
						<capture number="2" name="punctuation.definition.end"/>
					</ends-with>
					<subzones>
						<include syntax="language-root.xml" collection="tag-attributes"/>
					</subzones>
				</zone>
				<zone name="embedded.language-root.css">
					<starts-with>
						<expression>(?&lt;=>)\s*(&lt;!\[CDATA\[)?</expression>
						<capture number="1" name="comment.cdata.embedded"/>
					</starts-with>
					<ends-with>
						<expression>(]]&gt;\s*)?(?=&lt;/(?i:style)>)</expression>
						<capture number="1" name="comment.cdata.embedded"/>
					</ends-with>
					<subzones>
						<include syntax="language-root.css"/>
					</subzones>
				</zone>
			</subzones>
		</zone>
		
		<!-- Embedded JavaScript block -->
		<zone name="embedded-javascript.svg">
			<starts-with>
				<expression>(?=&lt;(?i:script))</expression>
			</starts-with>
			<ends-with>
				<expression>(&lt;/)((?i:script))(>)</expression>
				<capture number="0" name="tag.close.script.xml"/>
				<capture number="1" name="punctuation.definition.begin"/>
				<capture number="2" name="entity.name"/>
				<capture number="3" name="punctuation.definition.end"/>
			</ends-with>
			<subzones>
				<zone name="tag.open.script.xml">
					<starts-with>
						<expression>(&lt;)((?i:script))</expression>
						<capture number="1" name="punctuation.definition.begin"/>
						<capture number="2" name="entity.name"/>
					</starts-with>
					<ends-with>
						<expression>(/?)(>)</expression>
						<capture number="1" name="punctuation.definition.self-closing"/>
						<capture number="2" name="punctuation.definition.end"/>
					</ends-with>
					<subzones>
						<include syntax="language-root.xml" collection="tag-attributes"/>
					</subzones>
				</zone>
				<zone name="embedded.language-root.js">
					<starts-with>
						<expression>(?&lt;=>)\s*(&lt;!\[CDATA\[)?</expression>
						<capture number="1" name="comment.cdata.embedded"/>
					</starts-with>
					<ends-with>
						<expression>(]]&gt;\s*)?(?=&lt;/(?i:script)>)</expression>
						<capture number="1" name="comment.cdata.embedded"/>
					</ends-with>
					<subzones>
						<include syntax="language-root.js"/>
					</subzones>
				</zone>
			</subzones>
		</zone>
		
		<!-- Everything else is identical to normal XML -->
		<include syntax="language-root.xml"/>
	</zones>
</syntax>
