PageRenderTime 12ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Main/Source/Sandcastle/Presentation/Prototype/transforms/main_reference.xsl

#
Extensible Stylesheet Language Transformations | 220 lines | 201 code | 19 blank | 0 comment | 0 complexity | b0e348dcc712632d0c221d81a88e97df MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1<?xml version="1.0"?>
  2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
  3		xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5"
  4		xmlns:MSHelp="http://msdn.microsoft.com/mshelp" >
  5
  6  <!-- stuff specific to comments authored in DDUEXML -->
  7
  8	<xsl:include href="utilities_reference.xsl" />
  9	<xsl:include href="utilities_dduexml.xsl" />
 10
 11	<xsl:variable name="summary" select="normalize-space(/document/comments/ddue:dduexml/ddue:summary)" />
 12
 13	<xsl:template name="body">
 14
 15    <!--internalOnly boilerplate -->
 16    <xsl:call-template name="internalOnly"/>
 17    <!-- obsolete boilerplate -->
 18    <xsl:if test="/document/reference/attributes/attribute/type[@api='T:System.ObsoleteAttribute']">
 19      <xsl:call-template name="obsoleteSection" />
 20    </xsl:if>
 21    <!-- HostProtectionAttribute boilerplate -->
 22    <xsl:if test="/document/reference/attributes/attribute/type[@api='T:System.Security.Permissions.HostProtectionAttribute']">
 23      <p><include item="hostProtectionAttributeLong" /></p>
 24    </xsl:if>
 25		<!-- summary -->
 26    <span sdata="authoredSummary">
 27		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:summary" />
 28    </span>
 29		<!-- syntax -->
 30		<xsl:apply-templates select="/document/syntax" />
 31    <xsl:apply-templates select="/document/usyntax" />
 32    <!-- generic templates -->
 33		<xsl:apply-templates select="/document/templates" />
 34		<!-- parameters & return value -->
 35		<xsl:apply-templates select="/document/reference/templates" />
 36		<xsl:apply-templates select="/document/reference/parameters" />
 37		<xsl:apply-templates select="/document/reference/returns" />
 38		<!-- members -->
 39		<xsl:choose>
 40			<xsl:when test="$tgroup='root'">
 41				<xsl:apply-templates select="/document/reference/elements" mode="root" />
 42			</xsl:when>
 43			<xsl:when test="$group='namespace'">
 44				<xsl:apply-templates select="/document/reference/elements" mode="namespace" />
 45			</xsl:when>
 46			<xsl:when test="$subgroup='enumeration'">
 47				<xsl:apply-templates select="/document/reference/elements" mode="enumeration" />
 48			</xsl:when>
 49			<xsl:when test="$group='type'">
 50				<xsl:apply-templates select="/document/reference/elements" mode="type" />
 51			</xsl:when>
 52			<xsl:when test="$group='member'">
 53				<xsl:apply-templates select="/document/reference/elements" mode="overload" />
 54			</xsl:when>
 55		</xsl:choose>
 56		<!-- remarks -->
 57		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:remarks" />
 58		<!-- example -->
 59		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:codeExamples" />
 60		<!-- other comment sections -->
 61		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:threadSaftey" />
 62		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:notesForImplementers" />
 63		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:notesForCallers" />
 64		<!-- permissions -->
 65		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:permissions" />
 66		<!-- exceptions -->
 67		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:exceptions" />
 68		<!-- inheritance -->
 69		<xsl:apply-templates select="/document/reference/family" />
 70    <!-- interface implementors -->
 71    <xsl:apply-templates select="/document/reference/implementors" />
 72    <!-- versioning -->
 73    <xsl:apply-templates select="/document/reference/versions" />
 74		<!-- see also -->
 75		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:relatedTopics" />
 76		<!-- assembly information -->
 77		<xsl:apply-templates select="/document/reference/containers/library" />
 78
 79	</xsl:template> 
 80
 81  <xsl:template name="obsoleteSection">
 82    <p>
 83      <include item="obsoleteLong" />
 84      <xsl:for-each select="/document/comments/ddue:dduexml/ddue:obsoleteCodeEntity">
 85        <xsl:text> </xsl:text>
 86        <include item="nonobsoleteAlternative">
 87          <parameter>
 88            <xsl:apply-templates select="ddue:codeEntityReference" />
 89          </parameter>
 90        </include>
 91      </xsl:for-each>
 92    </p>
 93  </xsl:template>
 94
 95  <xsl:template name="internalOnly">
 96    <xsl:if test="/document/comments/ddue:dduexml/ddue:internalOnly">
 97      <div id="internalonly" class="seeAlsoNoToggleSection">
 98        <p/>
 99        <include item="internalOnly" />
100      </div>
101    </xsl:if>
102  </xsl:template>
103
104	<xsl:template match="templates">
105    <div id="genericParameters">
106		<xsl:call-template name="section">
107			<xsl:with-param name="title"><include item="templatesTitle" /></xsl:with-param>
108			<xsl:with-param name="content">
109					<xsl:for-each select="template">
110						<xsl:variable name="templateName" select="@name" />
111            <dl paramName="{$templateName}">
112						<dt>
113							<span class="parameter"><xsl:value-of select="$templateName"/></span>
114						</dt>
115						<dd>
116							<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:genericParameters/ddue:genericParameter[string(ddue:parameterReference)=$templateName]/ddue:content" />			
117						</dd>
118				</dl>
119          </xsl:for-each>
120			</xsl:with-param>
121		</xsl:call-template>
122    </div>
123	</xsl:template>
124
125	<xsl:template name="getParameterDescription">
126		<xsl:param name="name" />
127    <span sdata="authoredParameterSummary">
128		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:parameters/ddue:parameter[string(ddue:parameterReference)=$name]/ddue:content" />
129    </span>
130	</xsl:template>
131
132	<xsl:template match="returns">
133		<xsl:if test="normalize-space(/document/comments/ddue:dduexml/ddue:returnValue)">
134      <div id="returns">
135			<xsl:call-template name="section">
136				<xsl:with-param name="title">
137					<include>
138						<xsl:attribute name="item">
139							<xsl:value-of select="$subgroup" />
140							<xsl:text>ValueTitle</xsl:text>
141						</xsl:attribute>
142					</include>
143				</xsl:with-param>
144				<xsl:with-param name="content">
145					<xsl:call-template name="getReturnsDescription" />
146				</xsl:with-param>
147			</xsl:call-template>
148      </div>
149		</xsl:if>
150	</xsl:template>
151
152	<xsl:template name="getReturnsDescription">
153    <span sdata="authoredValueSummary">
154		<xsl:apply-templates select="/document/comments/ddue:dduexml/ddue:returnValue" />
155    </span>
156	</xsl:template>
157
158	<xsl:template name="getElementDescription">
159    <span sdata="memberAuthoredSummary">
160		<xsl:apply-templates select="ddue:summary/ddue:para/node()" />
161    </span>
162	</xsl:template>
163
164  <xsl:template name="getInternalOnlyDescription">
165    <xsl:if test="ddue:internalOnly">
166      <include item="infraStructure" />
167    </xsl:if>
168  </xsl:template>
169
170	<!-- DDUEXML elements that behave differently in conceptual and reference -->
171
172	<xsl:template match="ddue:exceptions">
173		<xsl:call-template name="section">
174			<xsl:with-param name="title"><include item="exceptionsTitle" /></xsl:with-param>
175			<xsl:with-param name="content">
176				<xsl:choose>
177					<xsl:when test="ddue:exception">
178						<table class="exceptions">
179							<tr>
180								<th class="exceptionNameColumn"><include item="exceptionNameHeader" /></th>
181								<th class="exceptionConditionColumn"><include item="exceptionConditionHeader" /></th>
182							</tr>
183							<xsl:for-each select="ddue:exception">
184								<tr>
185									<td><xsl:apply-templates select="ddue:codeEntityReference" /><br /></td>
186									<td><xsl:apply-templates select="ddue:content" /><br /></td>
187								</tr>
188							</xsl:for-each>
189						</table>
190					</xsl:when>
191					<xsl:otherwise>
192						<xsl:apply-templates />
193					</xsl:otherwise>
194				</xsl:choose>
195			</xsl:with-param>
196		</xsl:call-template>
197	</xsl:template>
198
199	<xsl:template match="ddue:permissions">
200		<xsl:call-template name="section">
201			<xsl:with-param name="title"><include item="permissionsTitle" /></xsl:with-param>
202			<xsl:with-param name="content">
203				<ul>
204					<xsl:for-each select="ddue:permission">
205						<li>
206							<xsl:apply-templates select="ddue:codeEntityReference" />
207							<xsl:text> </xsl:text>
208							<xsl:apply-templates select="ddue:content" />
209						</li>
210					</xsl:for-each>
211				</ul>
212			</xsl:with-param>
213		</xsl:call-template>
214	</xsl:template>
215
216  <xsl:template match="ddue:codeExample">
217    <xsl:apply-templates />
218  </xsl:template>
219  
220</xsl:stylesheet>