1 <?xml version=
"1.0" encoding=
"UTF-8"?>
3 This XSLT stylesheet is used to strip the XUL Elements Reference found at
4 http://www.xulplanet.com/references/elemref/refall_elemref.xml of unneeded
5 information for further processing by xulplanet2schema.xsl into a W3C Schema.
7 Please see http://mozilla.doslash.org/xulschema for more information.
10 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform" version=
"1.0">
12 <xsl:template match=
"/elements">
14 <xsl:apply-templates select=
"element"/>
15 <xsl:apply-templates select=
"events"/>
16 <xsl:apply-templates select=
"object[@name='XULElement']"/>
19 <!-- ===================== <element> ============================ -->
20 <xsl:template match=
"element">
22 <xsl:copy-of select=
"@*|reference|child::reference/following-sibling::text()"/>
23 <xsl:apply-templates select=
"attr"/>
26 <!-- ============== <object name="XULElement"> ================== -->
27 <xsl:template match=
"object">
28 <object name=
"XULElement">
29 <xsl:apply-templates select=
"attr"/>
32 <xsl:template match=
"attr">
34 <xsl:when test=
"parent::element">
35 <!-- For <element>s check if the attribute was already declared on XULElement -->
36 <xsl:variable name=
"name" select=
"@name"/>
39 test=
"not(//object[@name='XULElement']/attr[@name=current()/@name]) and not(//event[@name=current()/@name])">
41 <xsl:copy-of select=
"@*"/>
42 <xsl:apply-templates/>
46 <xsl:comment> attribute
<xsl:value-of select=
"@name"/> is not copied because it's duplicate
</xsl:comment>
51 <!-- Just copy XULElement's attributes -->
53 <xsl:copy-of select=
"@*"/>
54 <xsl:apply-templates/>
59 <!-- ================= Default action: copy ==================== -->
60 <xsl:template match=
"@*|node()">
62 <xsl:apply-templates select=
"@*|node()"/>