source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet.Doc/Help/Presentation/Style/Transforms/xamlSyntax.xsl@ 1146

Last change on this file since 1146 was 1146, checked in by Sam Habiel, 13 years ago

Initial Import of BMX4

File size: 22.6 KB
Line 
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
2 xmlns:MSHelp="http://msdn.microsoft.com/mshelp"
3 xmlns:mshelp="http://msdn.microsoft.com/mshelp"
4 xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5"
5 xmlns:xlink="http://www.w3.org/1999/xlink"
6 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
7 >
8
9 <xsl:import href="globalTemplates.xsl"/>
10
11 <xsl:variable name="showNonXamlAssemblyBoilerplate" select="'false'" />
12
13 <!-- XAML Syntax -->
14
15 <xsl:template name="XamlSyntaxBlock">
16 <!-- Branch based on pagetype -->
17 <xsl:choose>
18 <!-- Display boilerplate for pagetypes that cannot be used in XAML,
19 unless there's an authored XAML text section, which is used in place of the boilerplate. -->
20 <xsl:when test="$subgroup='method' or
21 $subgroup='constructor' or
22 $subgroup='interface' or
23 $subgroup='delegate' or
24 $subgroup='field'">
25 <xsl:call-template name="nonXamlMembersXamlSyntax"/>
26 </xsl:when>
27
28 <!-- class and struct -->
29 <xsl:when test="$subgroup='class' or
30 $subgroup='structure'">
31 <xsl:call-template name="classOrStructXamlSyntax"/>
32 </xsl:when>
33
34 <!-- enumeration -->
35 <xsl:when test="$subgroup='enumeration'">
36 <xsl:call-template name="enumerationXamlSyntax"/>
37 </xsl:when>
38
39 <!-- property -->
40 <xsl:when test="$subgroup='property' or $subsubgroup='attachedProperty'">
41 <xsl:call-template name="propertyXamlSyntax"/>
42 </xsl:when>
43
44 <!-- event -->
45 <xsl:when test="$subgroup='event' or $subsubgroup='attachedEvent'">
46 <xsl:call-template name="eventXamlSyntax"/>
47 </xsl:when>
48
49 </xsl:choose>
50 </xsl:template>
51
52 <!-- XAML syntax for CLASS and STRUCT topics. This is the logic:
53 if authored OESyntax,
54 display it
55 else if autogen OESyntax (AND no authored XAML section),
56 display it.
57 if authored AttrUsage,
58 display it
59 if authored XAML section,
60 display it
61 if no (authored OESyntax OR authored AttrUsage OR authored XAML section),
62 display autogen boilerplate
63 display XAML Values section, if any
64 -->
65 <xsl:template name="classOrStructXamlSyntax">
66 <!-- Object Element Usage
67 //ddue:section[starts-with(@address,'xamlValues')]
68 //ddue:section[starts-with(@address,'xamlTextUsage')]
69 //ddue:section[starts-with(@address,'xamlAttributeUsage')]
70 //ddue:section[starts-with(@address,'xamlPropertyElementUsage')]
71 //ddue:section[starts-with(@address,'xamlImplicitCollectionUsage')]
72 //ddue:section[starts-with(@address,'xamlObjectElementUsage')]
73 //ddue:section[starts-with(@address,'dependencyPropertyInfo')]
74 //ddue:section[starts-with(@address,'routedEventInfo')]
75 -->
76 <xsl:choose>
77 <!-- Show the authored Object Element Usage, if any. -->
78 <xsl:when test="//ddue:section[starts-with(@address,'xamlObjectElementUsage')]">
79 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlObjectElementUsage')][1]">
80 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
81 </xsl:for-each>
82 </xsl:when>
83 <!-- Else if no authored xamlTextUsage section, show the autogenerated Object Element Usage, if any. -->
84 <xsl:when test="not(//ddue:section[starts-with(@address,'xamlTextUsage')])">
85 <xsl:call-template name="ShowAutogeneratedXamlSyntax">
86 <xsl:with-param name="autogenContent">
87 <xsl:copy-of select="div[@class='xamlObjectElementUsageHeading']"/>
88 </xsl:with-param>
89 </xsl:call-template>
90 </xsl:when>
91 </xsl:choose>
92 <!-- Implicit Collection Usage - show authored section, if any. -->
93 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlImplicitCollectionUsage')][1]">
94 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
95 </xsl:for-each>
96 <!-- Attribute Usage - show authored section, if any. -->
97 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlAttributeUsage')][1]">
98 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
99 </xsl:for-each>
100 <!-- XAML Text section - show authored section, if any. -->
101 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlTextUsage')][1]">
102 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
103 </xsl:for-each>
104 <!-- Autogen - show autogen boilerplate, if no authored xaml sections to override it. -->
105 <xsl:if test="not(//ddue:section[starts-with(@address,'xamlObjectElementUsage')] or //ddue:section[starts-with(@address,'xamlImplicitCollectionUsage')] or //ddue:section[starts-with(@address,'xamlAttributeUsage')] or //ddue:section[starts-with(@address,'xamlTextUsage')])">
106 <xsl:call-template name="ShowXamlSyntaxBoilerplate">
107 <xsl:with-param name="param0">
108 <xsl:copy-of select="."/>
109 </xsl:with-param>
110 </xsl:call-template>
111 </xsl:if>
112 <!-- Show the authored XAML Values section, if any. -->
113 <xsl:call-template name="showXamlValuesSection"/>
114 </xsl:template>
115
116 <!-- XAML syntax for ENUMERATION topics. This is the logic:
117 if authored AttrUsage,
118 display it
119 if authored XAML section,
120 display it
121 if no (authored AttrUsage OR authored XAML section),
122 display autogen AttrUsage or boilerplate.
123 display XAML Values section, if any
124 -->
125 <xsl:template name="enumerationXamlSyntax">
126 <!-- Attribute Usage - show authored section, if any. -->
127 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlAttributeUsage')][1]">
128 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
129 </xsl:for-each>
130 <!-- XAML Text section - show authored section, if any. -->
131 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlTextUsage')][1]">
132 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
133 </xsl:for-each>
134 <!-- Autogen - show enum syntax boilerplate, if no authored xaml sections to override it. -->
135 <xsl:choose>
136 <xsl:when test="$showNonXamlAssemblyBoilerplate='false' and div[@class='nonXamlAssemblyBoilerplate']"/>
137 <xsl:when test="not(//ddue:section[starts-with(@address,'xamlAttributeUsage')] or //ddue:section[starts-with(@address,'xamlTextUsage')])">
138 <span codeLanguage="XAML">
139 <table>
140 <tr>
141 <th>
142 <include item="xamlAttributeUsageHeading" />
143 </th>
144 </tr>
145 <tr>
146 <td>
147 <pre xml:space="preserve"><xsl:text/><include item="enumerationOverviewXamlSyntax"/></pre>
148 </td>
149 </tr>
150 </table>
151 </span>
152 </xsl:when>
153 </xsl:choose>
154 <!-- Show the authored XAML Values section, if any. -->
155 <xsl:call-template name="showXamlValuesSection"/>
156 </xsl:template>
157
158 <!-- XAML syntax for PROPERTY topics. This is the logic:
159 if authored OESyntax,
160 display it
161 if authored PEUsage,
162 display it
163 else if autogen PEUsage (AND no authored XAML section),
164 display it
165 if authored AttrUsage,
166 display it
167 else if autogen AttrUsage (AND no authored XAML section),
168 display it
169 if authored XAML section,
170 display it
171 if no (authored OESyntax OR authored PEUsage OR authored AttrUsage OR authored XAML section),
172 display autogen boilerplate
173 -->
174 <xsl:template name="propertyXamlSyntax">
175 <!-- Object Element Usage - show authored section, if any. -->
176 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlObjectElementUsage')][1]">
177 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
178 </xsl:for-each>
179 <!-- Property Element Usage -->
180 <xsl:choose>
181 <!-- Show the authored Property Element Usage, if any. -->
182 <xsl:when test="//ddue:section[starts-with(@address,'xamlPropertyElementUsage')]">
183 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlPropertyElementUsage')][1]">
184 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
185 </xsl:for-each>
186 </xsl:when>
187 <!-- Else if no authored xamlTextUsage section, show the autogenerated Property Element Usage, if any. -->
188 <xsl:when test="not(//ddue:section[starts-with(@address,'xamlTextUsage')])">
189 <xsl:call-template name="ShowAutogeneratedXamlSyntax">
190 <xsl:with-param name="autogenContent">
191 <xsl:copy-of select="div[@class='xamlPropertyElementUsageHeading' or @class='xamlContentElementUsageHeading']"/>
192 </xsl:with-param>
193 </xsl:call-template>
194 </xsl:when>
195 </xsl:choose>
196 <!-- Attribute Usage -->
197 <xsl:choose>
198 <!-- Show the authored Attribute Usage, if any. -->
199 <xsl:when test="//ddue:section[starts-with(@address,'xamlAttributeUsage')]">
200 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlAttributeUsage')][1]">
201 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
202 </xsl:for-each>
203 </xsl:when>
204 <!-- Else if no authored xamlTextUsage section, show the autogenerated Attribute Usage, if any. -->
205 <xsl:when test="not(//ddue:section[starts-with(@address,'xamlTextUsage')])">
206 <xsl:call-template name="ShowAutogeneratedXamlSyntax">
207 <xsl:with-param name="autogenContent">
208 <xsl:copy-of select="div[@class='xamlAttributeUsageHeading']"/>
209 </xsl:with-param>
210 </xsl:call-template>
211 </xsl:when>
212 </xsl:choose>
213 <!-- XAML Text section - show authored section, if any. -->
214 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlTextUsage')][1]">
215 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
216 </xsl:for-each>
217 <!-- Autogen - show autogen boilerplate, if no authored xaml sections to override it. -->
218 <xsl:if test="not(//ddue:section[starts-with(@address,'xamlObjectElementUsage')] or //ddue:section[starts-with(@address,'xamlPropertyElementUsage')] or //ddue:section[starts-with(@address,'xamlAttributeUsage')] or //ddue:section[starts-with(@address,'xamlTextUsage')])">
219 <xsl:call-template name="ShowXamlSyntaxBoilerplate">
220 <xsl:with-param name="param0">
221 <xsl:copy-of select="div/*"/>
222 </xsl:with-param>
223 </xsl:call-template>
224 </xsl:if>
225 <!-- Show the authored XAML Values section, if any. -->
226 <xsl:call-template name="showXamlValuesSection"/>
227 </xsl:template>
228
229 <!-- XAML syntax for EVENT topics. This is the logic:
230 if authored AttrUsage,
231 display it
232 if authored XAML section,
233 display it
234 if no (authored AttrUsage OR authored XAML section),
235 display autogen AttrUsage or boilerplate.
236 display XAML Values section, if any
237 -->
238 <xsl:template name="eventXamlSyntax">
239 <!-- Attribute Usage - show authored section, if any. -->
240 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlAttributeUsage')][1]">
241 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
242 </xsl:for-each>
243 <!-- XAML Text section - show authored section, if any. -->
244 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlTextUsage')][1]">
245 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
246 </xsl:for-each>
247 <!-- Autogen - show autogen syntax or boilerplate, if no authored xaml sections to override it. -->
248 <xsl:if test="not(//ddue:section[starts-with(@address,'xamlAttributeUsage')] or //ddue:section[starts-with(@address,'xamlTextUsage')])">
249 <!-- If XamlSyntax component generated an Attribute Usage block, this template will show it. -->
250 <xsl:call-template name="ShowAutogeneratedXamlSyntax">
251 <xsl:with-param name="autogenContent">
252 <xsl:copy-of select="div[@class='xamlAttributeUsageHeading']"/>
253 </xsl:with-param>
254 </xsl:call-template>
255 <!-- If XamlSyntax component generated a boilerplate block, this template will show it. -->
256 <xsl:call-template name="ShowXamlSyntaxBoilerplate">
257 <xsl:with-param name="param0">
258 <xsl:copy-of select="div/*"/>
259 </xsl:with-param>
260 </xsl:call-template>
261 </xsl:if>
262 <!-- Show the authored XAML Values section, if any. -->
263 <xsl:call-template name="showXamlValuesSection"/>
264 </xsl:template>
265
266 <!-- XAML syntax for members that cannot be used in XAML: interface, delegate, method, field, constructor.
267 If there's an authored XAML section, show it. Otherwise, use the standard boilerplate. -->
268 <xsl:template name="nonXamlMembersXamlSyntax">
269 <xsl:choose>
270 <!-- XAML Text section - show authored section, if any. -->
271 <xsl:when test="//ddue:section[starts-with(@address,'xamlTextUsage')]">
272 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlTextUsage')][1]">
273 <xsl:call-template name="ShowAuthoredXamlSyntax"/>
274 </xsl:for-each>
275 </xsl:when>
276 <!-- Autogen - show autogen boilerplate, if no authored xaml sections to override it. -->
277 <xsl:otherwise>
278 <xsl:call-template name="ShowXamlSyntaxBoilerplate"/>
279 </xsl:otherwise>
280 </xsl:choose>
281 </xsl:template>
282
283 <!-- Displays one of the standard XAML boilerplate strings. -->
284 <xsl:template name="ShowXamlSyntaxBoilerplate">
285 <xsl:param name="param0"/>
286 <xsl:variable name="boilerplateId">
287 <xsl:choose>
288 <!-- don't show boilerplate for apis that are not in xaml assemblies -->
289 <xsl:when test="$showNonXamlAssemblyBoilerplate='false' and div[@class='nonXamlAssemblyBoilerplate']"/>
290 <xsl:otherwise>
291 <xsl:value-of select="div/@class[not(.='xamlAttributeUsageHeading' or
292 .='xamlObjectElementUsageHeading' or
293 .='xamlContentElementUsageHeading' or
294 .='xamlPropertyElementUsageHeading' or
295 .='xamlXmlnsUri')]"/>
296 </xsl:otherwise>
297 </xsl:choose>
298 </xsl:variable>
299 <xsl:if test="$boilerplateId!=''">
300 <span codeLanguage="XAML">
301 <table>
302 <tr>
303 <th>
304 <include item="xamlSyntaxBoilerplateHeading" />
305 </th>
306 </tr>
307 <tr>
308 <td>
309 <pre xml:space="preserve"><span class="message"><xsl:text/><include item="{$boilerplateId}">
310 <xsl:choose>
311 <xsl:when test="$param0!=''">
312 <parameter>
313 <xsl:copy-of select="msxsl:node-set($param0)"/>
314 </parameter>
315 </xsl:when>
316 <!-- make sure we at least pass in an empty param because some boilerplates expect them -->
317 <xsl:otherwise>
318 <parameter/>
319 </xsl:otherwise>
320 </xsl:choose>
321 </include></span></pre>
322 </td>
323 </tr>
324 </table>
325 </span>
326 </xsl:if>
327 </xsl:template>
328
329 <!-- Displays an authored XAML syntax section -->
330 <xsl:template name="ShowAuthoredXamlSyntax">
331 <xsl:if test="ddue:content[normalize-space(.)!='']">
332 <xsl:variable name="headingID">
333 <xsl:choose>
334 <xsl:when test="starts-with(@address,'xamlObjectElementUsage')">xamlObjectElementUsageHeading</xsl:when>
335 <xsl:when test="starts-with(@address,'xamlImplicitCollectionUsage')">xamlImplicitCollectionUsageHeading</xsl:when>
336 <xsl:when test="starts-with(@address,'xamlPropertyElementUsage')">
337 <xsl:choose>
338 <xsl:when test="//div[@class='xamlContentElementUsageHeading']">xamlContentElementUsageHeading</xsl:when>
339 <xsl:otherwise>xamlPropertyElementUsageHeading</xsl:otherwise>
340 </xsl:choose>
341 </xsl:when>
342 <xsl:when test="starts-with(@address,'xamlAttributeUsage')">xamlAttributeUsageHeading</xsl:when>
343 <xsl:when test="starts-with(@address,'xamlTextUsage')">xamlSyntaxBoilerplateHeading</xsl:when>
344 </xsl:choose>
345 </xsl:variable>
346 <span codeLanguage="XAML">
347 <table>
348 <tr>
349 <th>
350 <include item="{$headingID}" />
351 </th>
352 </tr>
353 <xsl:choose>
354 <xsl:when test="$headingID='xamlSyntaxBoilerplateHeading'">
355 <tr>
356 <td>
357 <xsl:apply-templates select="ddue:content"/>
358 </td>
359 </tr>
360 </xsl:when>
361 <xsl:otherwise>
362 <tr>
363 <td>
364 <pre xml:space="preserve"><xsl:choose>
365 <xsl:when test="ddue:content/ddue:code"><xsl:apply-templates select="ddue:content/ddue:code[1]/node()" /></xsl:when>
366 <xsl:when test="ddue:content/ddue:para"><xsl:apply-templates select="ddue:content/ddue:para"/></xsl:when>
367 </xsl:choose></pre>
368 </td>
369 </tr>
370 </xsl:otherwise>
371 </xsl:choose>
372 </table>
373 </span>
374 </xsl:if>
375 </xsl:template>
376
377 <!-- Displays the autogenerated XAML syntax for pagetypes other than enumerations -->
378 <xsl:template name="ShowAutogeneratedXamlSyntax">
379 <xsl:param name="autogenContent"/>
380 <xsl:if test="count(msxsl:node-set($autogenContent))>0">
381 <xsl:for-each select="msxsl:node-set($autogenContent)/div">
382 <xsl:variable name="headingID">
383 <xsl:value-of select="@class"/>
384 </xsl:variable>
385 <span codeLanguage="XAML">
386 <table>
387 <tr>
388 <th>
389 <include item="{$headingID}" />
390 </th>
391 </tr>
392 <tr>
393 <td>
394 <pre xml:space="preserve"><xsl:text/><xsl:copy-of select="node()"/></pre>
395 </td>
396 </tr>
397 </table>
398 </span>
399 </xsl:for-each>
400 </xsl:if>
401 </xsl:template>
402
403 <!-- Display the XAML Values section. -->
404 <xsl:template name="showXamlValuesSection">
405 <xsl:for-each select="//ddue:section[starts-with(@address,'xamlValues')]">
406 <span codeLanguage="XAML">
407 <p/>
408 <xsl:call-template name="subSection">
409 <xsl:with-param name="title">
410 <include item="xamlValuesSectionHeading" />
411 </xsl:with-param>
412 <xsl:with-param name="content">
413 <xsl:apply-templates select="ddue:content"/>
414 </xsl:with-param>
415 </xsl:call-template>
416 </span>
417 </xsl:for-each>
418 </xsl:template>
419
420 <!-- these xaml sections are captured in the xaml syntax processing, so this template prevents them from showing up twice -->
421 <xsl:template match="//ddue:section[starts-with(@address,'xamlValues') or
422 starts-with(@address,'xamlTextUsage') or
423 starts-with(@address,'xamlAttributeUsage') or
424 starts-with(@address,'xamlPropertyElementUsage') or
425 starts-with(@address,'xamlImplicitCollectionUsage') or
426 starts-with(@address,'xamlObjectElementUsage') or
427 starts-with(@address,'dependencyPropertyInfo') or
428 starts-with(@address,'routedEventInfo')]"/>
429
430 <!-- the authored dependency Property Information section -->
431 <xsl:template match="ddue:section[starts-with(@address,'dependencyPropertyInfo')]" mode="section">
432 <xsl:call-template name="section">
433 <xsl:with-param name="toggleSwitch" select="'dependencyPropertyInfo'"/>
434 <xsl:with-param name="title">
435 <include item="dependencyPropertyInfoHeading" />
436 </xsl:with-param>
437 <xsl:with-param name="content">
438 <xsl:apply-templates select="ddue:content" />
439 </xsl:with-param>
440 </xsl:call-template>
441 </xsl:template>
442
443 <!-- the authored routed event Information section -->
444 <xsl:template match="ddue:section[starts-with(@address,'routedEventInfo')]" mode="section">
445 <xsl:call-template name="section">
446 <xsl:with-param name="toggleSwitch" select="'routedEventInfo'"/>
447 <xsl:with-param name="title">
448 <include item="routedEventInfoHeading" />
449 </xsl:with-param>
450 <xsl:with-param name="content">
451 <xsl:apply-templates select="ddue:content" />
452 </xsl:with-param>
453 </xsl:call-template>
454 </xsl:template>
455
456 <!-- Show XAML xmlns for apis that support XAML -->
457 <xsl:template name="xamlXmlnsInfo">
458 <xsl:variable name="hasAuthoredXamlSyntax" select="boolean(//ddue:sections/ddue:section[
459 starts-with(@address,'xamlTextUsage') or
460 starts-with(@address,'xamlAttributeUsage') or
461 starts-with(@address,'xamlPropertyElementUsage') or
462 starts-with(@address,'xamlImplicitCollectionUsage') or
463 starts-with(@address,'xamlObjectElementUsage')])" />
464 <xsl:variable name="hasAutogeneratedXamlSyntax" select="boolean(/document/syntax/div[@codeLanguage='XAML']/div[
465 @class='xamlAttributeUsageHeading' or
466 @class='xamlObjectElementUsageHeading' or
467 @class='xamlContentElementUsageHeading' or
468 @class='xamlPropertyElementUsageHeading'])" />
469 <!-- All topics that have authored or autogen'd xaml syntax get an "XMLNS for XAML" line in the Requirements section.
470 Topics with boilerplate xaml syntax, e.g. "Not applicable", do NOT get this line. -->
471 <xsl:if test="$hasAuthoredXamlSyntax or $hasAutogeneratedXamlSyntax">
472 <br/>
473 <include item="xamlXmlnsRequirementsLayout">
474 <parameter>
475 <xsl:choose>
476 <xsl:when test="/document/syntax/div[@codeLanguage='XAML']/div[@class='xamlXmlnsUri']">
477 <xsl:for-each select="/document/syntax/div[@codeLanguage='XAML']/div[@class='xamlXmlnsUri']">
478 <xsl:if test="position()!=1"><xsl:text>, </xsl:text></xsl:if>
479 <xsl:value-of select="."/>
480 </xsl:for-each>
481 </xsl:when>
482 <xsl:otherwise>
483 <include item="unmappedXamlXmlns"/>
484 </xsl:otherwise>
485 </xsl:choose>
486 </parameter>
487 </include>
488 </xsl:if>
489 </xsl:template>
490
491</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.