1 <?xml version=
"1.0" encoding=
"UTF-8"?>
3 This XSLT stylesheet is used to transform structure information in
4 xulstructure.xml into a W3C Schema definitions. Please see
5 http://mozilla.doslash.org/xulschema for more information.
8 <xsl:stylesheet xmlns:
xs=
"http://www.w3.org/2001/XMLSchema"
9 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform" version=
"1.0">
11 <xsl:template match=
"/elements">
12 <xs:schema xmlns:
xul=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
13 targetNamespace=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
14 <xsl:apply-templates/>
18 <xsl:template match=
"type">
20 <xsl:with-param name=
"type" select=
"concat(@name,'ElementType')"/>
21 </xsl:apply-templates>
24 <xsl:template match=
"element[@name]">
25 <xsl:param name=
"type"/>
26 <xs:complexType name=
"{@name}ElementType">
28 <xs:extension base=
"xul:{$type}">
29 <xsl:apply-templates/>
34 <xsl:template match=
"group[@name]">
35 <xs:group name=
"{@name}ElementGroup">
36 <xsl:apply-templates/>
39 <!-- ElementType definitions -->
40 <xsl:template match=
"definetype">
41 <xs:complexType name=
"{@name}ElementType">
43 <xsl:when test=
"@derive">
45 <xs:extension base=
"xul:{@derive}ElementType">
46 <xsl:apply-templates/>
51 <xsl:apply-templates/>
56 <xsl:template match=
"defineelement">
57 <xs:element name=
"{@name}"/>
60 <xsl:template match=
"element[@ref]">
61 <xs:element ref=
"xul:{@ref}">
62 <xsl:copy-of select=
"@minOccurs|@maxOccurs"/>
65 <xsl:template match=
"group[@ref]">
66 <xs:group ref=
"xul:{@ref}ElementGroup">
67 <xsl:copy-of select=
"@minOccurs|@maxOccurs"/>
70 <xsl:template match=
"attributeGroup[@ref]">
71 <xs:attributeGroup ref=
"xul:{@ref}AttributeGroup"/>
73 <!-- rng -> schema -->
74 <xsl:template match=
"zeroOrMore">
75 <xs:choice minOccurs=
"0" maxOccurs=
"unbounded">
76 <xsl:apply-templates/>
79 <xsl:template match=
"oneOrMore">
80 <xs:choice maxOccurs=
"unbounded">
81 <xsl:apply-templates/>
85 <xsl:template match=
"choice">
87 <xsl:copy-of select=
"@minOccurs|@maxOccurs"/>
88 <xsl:apply-templates/>
91 <xsl:template match=
"sequence">
93 <xsl:copy-of select=
"@minOccurs|@maxOccurs"/>
94 <xsl:apply-templates/>
97 <xsl:template match=
"all">
99 <xsl:apply-templates/>
102 <xsl:template match=
"any">
104 <xsl:copy-of select=
"@*"/>
107 <xsl:template match=
"optional">
108 <xs:sequence minOccurs=
"0" maxOccurs=
"1">
109 <xsl:apply-templates/>