Disabled one of the ordering tests that was taking a while to run.
[jquery.git] / build / style.xsl
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3         
4         <xsl:output method="xml" indent="yes" />
5         
6         <!-- TODO convert @type array notation to bracket notation, eg. Array<DOMElement> to [DOMElement] -->
7         <xsl:template match="/*">
8                 <api xmlns="http://openajax.org/metadata">
9                         <class name="jQuery">
10                                 <constructors>
11                                         <xsl:for-each select="//function[@name='jQuery']">
12                                                 <constructor>
13                                                         <shortDescription><xsl:value-of select="desc" /></shortDescription>
14                                                         <description><xsl:value-of select="longdesc" /></description>
15                                                         <xsl:call-template name="parameters" />
16                                                         <returnType datatype="{@return}" />
17                                                         <xsl:call-template name="examples" />
18                                                 </constructor>
19                                         </xsl:for-each>
20                                 </constructors>
21                                 <properties>
22                                         <xsl:for-each select="//property">
23                                                 <xsl:sort select="translate(@name,'$.','')"/>
24                                                 <xsl:sort select="count(params)"/>
25                                                 <property name="{@name}" readonly="true" datatype="{@return}" default="">
26                                                         <xsl:call-template name="scope" />
27                                                         <shortDescription><xsl:value-of select="desc" /></shortDescription>
28                                                         <description><xsl:value-of select="longdesc" /></description>
29                                                         <xsl:call-template name="examples" />
30                                                 </property>
31                                         </xsl:for-each>
32                                 </properties>
33                                 <methods>
34                                         <xsl:for-each select="//function[@name!='jQuery']">
35                                                 <xsl:sort select="translate(@name,'$.','')"/>
36                                                 <xsl:sort select="count(params)"/>
37                                                 <method name="{@name}">
38                                                         <xsl:call-template name="scope" />
39                                                         <shortDescription><xsl:value-of select="desc" /></shortDescription>
40                                                         <description><xsl:value-of select="longdesc" /></description>
41                                                         <xsl:call-template name="parameters" />
42                                                         <returnType datatype="{@return}" />
43                                                         <xsl:call-template name="examples" />
44                                                 </method>
45                                         </xsl:for-each>
46                                 </methods>
47                         </class>
48                 </api>
49         </xsl:template>
50         
51         <xsl:template name="scope">
52                 <xsl:attribute name="scope">
53                         <xsl:choose>
54                                 <xsl:when test="starts-with(@name, 'jQuery.')">static</xsl:when>
55                                 <xsl:when test="not(starts-with(@name, 'jQuery.'))">instance</xsl:when>
56                         </xsl:choose>
57                 </xsl:attribute>
58         </xsl:template>
59         
60         <xsl:template name="parameters">
61                 <parameters>
62                         <xsl:for-each select="params">
63                                 <parameter name="{@name}" datatype="{@type}">
64                                         <xsl:attribute name="usage">
65                                                 <xsl:choose>
66                                                         <xsl:when test="not(@optional)">required</xsl:when>
67                                                         <xsl:when test="@optional">optional</xsl:when>
68                                                 </xsl:choose>
69                                         </xsl:attribute>
70                                         <description><xsl:value-of select="desc" /></description>
71                                         <!-- TODO part of the spec, but with a very different interpretation -->
72                                         <xsl:choose>
73                                                 <xsl:when test="../option">
74                                                         <properties>
75                                                                 <xsl:for-each select="../option">
76                                                                         <property name="{@name}" datatype="{@type}" default="{@default}">
77                                                                                 <description><xsl:value-of select="desc" /></description>
78                                                                         </property>
79                                                                 </xsl:for-each>
80                                                         </properties>
81                                                 </xsl:when>
82                                         </xsl:choose>
83                                 </parameter>
84                         </xsl:for-each>
85                 </parameters>
86         </xsl:template>
87         
88         <xsl:template name="examples">
89                 <examples>
90                         <xsl:for-each select="example">
91                                 <example>
92                                         <description><xsl:value-of select="desc" /></description>
93                                         <xsl:copy-of select="code|html|css" />
94                                 </example>
95                         </xsl:for-each>
96                 </examples>
97         </xsl:template>
98         
99 </xsl:stylesheet>