1 <?xml version="1.0" encoding="utf-8"?>
\r
2 <xsl:stylesheet version="1.0"
\r
3 xmlns ="http://www.w3.org/1999/xhtml"
\r
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
5 xmlns:xs ="http://www.w3.org/2001/XMLSchema">
\r
6 <xsl:template match="/">
\r
7 <xsl:apply-templates select="xs:schema" />
\r
10 <xsl:template match="xs:schema">
\r
11 <html xml:lang="ja">
\r
13 <title>XML Schema</title>
\r
14 <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
\r
15 <link rel="stylesheet" href="style.css" type="text/css" />
\r
21 <li><a href="readme.html">Readme</a></li>
\r
22 <li><a href="files.html">Files</a></li>
\r
23 <li><a href="history.html">History</a></li>
\r
24 <li><a href="api/index.html">TPI spec</a></li>
\r
26 <li><a href="license.txt">License</a></li>
\r
29 <li><a href="#about">About</a></li>
\r
30 <li><a href="#element">Element</a></li>
\r
31 <li><a href="#complex">Complex type</a></li>
\r
32 <li><a href="#simple">Simple type</a></li>
\r
33 <li><a href="#attrgrp">Attribute group</a></li>
\r
36 <h2 id="about">About</h2>
\r
37 <p>This is schema file of TPI's common XML.</p>
\r
38 <h2 id="element">Element</h2>
\r
39 <xsl:apply-templates select="xs:element" />
\r
40 <h2 id="complex">Complex type</h2>
\r
41 <xsl:apply-templates select="xs:complexType" />
\r
42 <h2 id="simple">Simple type</h2>
\r
43 <xsl:apply-templates select="xs:simpleType" />
\r
44 <h2 id="attrgrp">Attribute group</h2>
\r
45 <xsl:apply-templates select="xs:attributeGroup" />
\r
50 <xsl:template name="base">
\r
52 <xsl:attribute name="id">
\r
53 <xsl:value-of select="@name" />
\r
55 <xsl:value-of select="@name" />
\r
57 <div style="white-space:pre">
\r
58 <xsl:value-of select="xs:annotation/xs:documentation" />
\r
60 <xsl:apply-templates select="xs:sequence" />
\r
63 <xsl:template name="type">
\r
65 <xsl:when test="@type='xs:string'">(string)</xsl:when>
\r
66 <xsl:when test="@type='xs:int'">(int)</xsl:when>
\r
67 <xsl:when test="@type='xs:boolean'">(bool)</xsl:when>
\r
70 <xsl:attribute name="href">#<xsl:value-of select="@type" /></xsl:attribute>
\r
71 <xsl:value-of select="@type" />
\r
77 <xsl:template name="attributes">
\r
78 <xsl:if test="count(xs:attribute)!=0">
\r
80 <colgroup span="1" />
\r
82 <col span="1" style="text-align: center" />
\r
83 <col span="1" style="text-align: right" />
\r
86 <tr><th>attribute</th><th>type</th><th>default</th><th>description</th></tr>
\r
89 <xsl:for-each select="xs:attribute">
\r
92 <xsl:if test="@use='required'">
\r
93 <xsl:attribute name="style">color: red</xsl:attribute>
\r
94 <xsl:attribute name="title">Required</xsl:attribute>
\r
96 <xsl:value-of select="@name" />
\r
98 <td><xsl:call-template name="type" /></td>
\r
99 <td><xsl:value-of select="@default" /></td>
\r
100 <td><xsl:value-of select="xs:annotation/xs:documentation" /></td>
\r
103 <xsl:if test="count(xs:attributeGroup)!=0">
\r
107 <xsl:for-each select="xs:attributeGroup">
\r
109 <xsl:attribute name="href">#<xsl:value-of select="@ref" /></xsl:attribute>
\r
110 <xsl:value-of select="@ref" />
\r
112 <xsl:if test="position()!=last()">, </xsl:if>
\r
122 <xsl:template match="xs:simpleType">
\r
123 <xsl:call-template name="base" />
\r
124 <h4>Restriction</h4>
\r
125 <p>Derived from <xsl:value-of select="xs:restriction/@base" />.</p>
\r
128 <xsl:template match="xs:complexType">
\r
129 <xsl:call-template name="base" />
\r
130 <xsl:call-template name="attributes" />
\r
133 <xsl:template match="xs:attributeGroup">
\r
134 <xsl:call-template name="base" />
\r
135 <xsl:call-template name="attributes" />
\r
138 <xsl:template match="xs:element">
\r
139 <xsl:call-template name="base" />
\r
140 <p>Type is <xsl:call-template name="type" />.</p>
\r
143 <xsl:template match="xs:sequence">
\r
147 <tr><th>name</th><th>min</th><th>max</th></tr>
\r
150 <xsl:for-each select="xs:element">
\r
154 <xsl:attribute name="href">#<xsl:value-of select="@ref" /></xsl:attribute>
\r
155 <xsl:value-of select="@ref" />
\r
158 <td><xsl:value-of select="@minOccurs" /></td>
\r
159 <td><xsl:value-of select="@maxOccurs" /></td>
\r