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