summaryrefslogtreecommitdiffstats
path: root/tools/Sandcastle/ProductionTransforms/ReflectionToChmIndex.xsl
blob: c6dc44e5562c775b80b26f004364d93a96bb6bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">

	<xsl:output method="text" encoding="iso-8859-1" />

	<xsl:key name="index" match="/reflection/apis/api" use="@id" />

	<xsl:template match="/">
		<xsl:text>&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML/EN"&gt;&#x0a;</xsl:text>
		<xsl:text>&lt;HTML&gt;&#x0a;</xsl:text>
		<xsl:text>  &lt;BODY&gt;&#x0a;</xsl:text>
		<xsl:text>    &lt;UL&gt;&#x0a;</xsl:text>

		<xsl:apply-templates select="/reflection/apis/api"/>

		<xsl:text>    &lt;/UL&gt;&#x0a;</xsl:text>
		<xsl:text>  &lt;/BODY&gt;&#x0a;</xsl:text>
		<xsl:text>&lt;/HTML&gt;&#x0a;</xsl:text>
	</xsl:template>

	<xsl:template match="api[apidata/@group='namespace']">
		<xsl:call-template name="createIndexEntry">
			<xsl:with-param name="text" select="concat(apidata/@name,' namespace')" />
			<xsl:with-param name="file" select="file/@name" />
		</xsl:call-template>
	</xsl:template>

	<xsl:template match="api[apidata/@group='type']">
		<xsl:variable name="namespace" select="key('index',containers/namespace/@api)/apidata/@name" />
		<xsl:call-template name="createIndexEntry">
			<xsl:with-param name="text" select="concat(apidata/@name,' ',apidata/@subgroup)" />
			<xsl:with-param name="file" select="file/@name" />
		</xsl:call-template>
		<xsl:call-template name="createIndexEntry">
			<xsl:with-param name="text" select="concat($namespace,'.',apidata/@name,' ',apidata/@subgroup)" />
			<xsl:with-param name="file" select="file/@name" />
		</xsl:call-template>
	</xsl:template>

	<xsl:template match="api[apidata/@group='member' and topicdata/@notopic !='']" >
		<xsl:variable name="type" select="key('index',containers/type/@api)" />
		<xsl:if test="not(apidata/@subgroup='constructor')">
			<xsl:call-template name="createIndexEntry">
				<xsl:with-param name="text">
					<xsl:value-of select="concat(apidata/@name,' ',apidata/@subgroup)" />
				</xsl:with-param>
				<xsl:with-param name="file" select="file/@name" />
			</xsl:call-template>
		</xsl:if>
		<xsl:call-template name="createIndexEntry">
			<xsl:with-param name="text">
				<xsl:choose>
					<xsl:when test="apidata/@subgroup='constructor'">
						<xsl:value-of select="concat($type/apidata/@name,' ',$type/apidata/@subgroup,', constructor')" />
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="concat($type/apidata/@name,'.',apidata/@name,' ',apidata/@subgroup)" />
					</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
			<xsl:with-param name="file" select="file/@name" />
		</xsl:call-template>
	</xsl:template>

	<xsl:template match="api" />

	<xsl:template name="createIndexEntry">
		<xsl:param name="text" />
		<xsl:param name="file" />
		<xsl:text>      &lt;LI&gt;&lt;OBJECT type="text/sitemap"&gt;&#x0a;</xsl:text>
		<xsl:text>        &lt;param name="Name" value="</xsl:text><xsl:value-of select="$text" /><xsl:text>"&gt;&#x0a;</xsl:text>
		<xsl:text>        &lt;param name="Local" value="html/</xsl:text><xsl:value-of select="$file" /><xsl:text>.htm"&gt;&#x0a;</xsl:text>
		<xsl:text>      &lt;/OBJECT&gt;&lt;LI&gt;&#x0a;</xsl:text>
		
	</xsl:template>

</xsl:stylesheet>