CCID: Add support for PC-to-Reader XfrBlock message
[pub/USBasp.git] / LUFA / StudioIntegration / Docbook / mshelp / hv1-common.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:d="http://docbook.org/ns/docbook"
4 xmlns="http://www.w3.org/1999/xhtml"
5 exclude-result-prefixes="d"
6 version="1.0">
7
8
9 <!-- no separate HTML page with index as this is binary in hv1 -->
10 <xsl:param name="generate.index" select="0"/>
11
12
13 <!-- Generate help tags in header -->
14 <xsl:template name="user.head.content">
15 <xsl:param name="node" select="''" />
16 <xsl:variable name="up" select="parent::*"/>
17
18 <!-- Locale should be first Help tag-->
19 <meta name="Microsoft.Help.Locale">
20 <xsl:attribute name="content">
21 <xsl:choose>
22 <xsl:when test="$product.locale and product.locale != ''">
23 <xsl:value-of select="$product.locale"/>
24 </xsl:when>
25 <xsl:otherwise>
26 <xsl:text>en-US</xsl:text>
27 </xsl:otherwise>
28 </xsl:choose>
29 </xsl:attribute>
30 </meta>
31
32 <!-- Specify locale for this chunk. Should probably query xml:lang -->
33 <meta name="Microsoft.Help.TopicLocale">
34 <xsl:attribute name="content">
35 <xsl:choose>
36 <xsl:when test="@xml:lang">
37 <xsl:value-of select="@xml:lang"/>
38 </xsl:when>
39 <xsl:when test="$product.locale and product.locale != ''">
40 <xsl:value-of select="$product.locale"/>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:text>en-US</xsl:text>
44 </xsl:otherwise>
45 </xsl:choose>
46 </xsl:attribute>
47 </meta>
48
49 <!-- This is the unique ID for this page -->
50 <meta name="Microsoft.Help.Id">
51 <xsl:attribute name="content">
52 <xsl:call-template name="hv1.toc.id"/>
53 </xsl:attribute>
54 </meta>
55
56 <!-- The ID of the parent TOC node (-1 is root) -->
57 <meta name="Microsoft.Help.TocParent">
58 <xsl:attribute name="content">
59 <xsl:call-template name="hv1.toc.parent.id">
60 <xsl:with-param name="up" select="$up"/>
61 </xsl:call-template>
62 </xsl:attribute>
63 </meta>
64
65 <!-- For all pages with the same parent, the order is set by TocOrder -->
66 <meta name="Microsoft.Help.TocOrder">
67 <xsl:attribute name="content">
68 <xsl:value-of select="1+count(preceding-sibling::chapter|preceding-sibling::section)"/>
69 </xsl:attribute>
70 </meta>
71
72 <!-- boolean to indicate if this page is allowed to load custom branding -->
73 <meta name="Microsoft.Help.SelfBranded">
74 <xsl:attribute name="content">
75 <xsl:choose>
76 <xsl:when test="$topic.selfbrand">
77 <xsl:text>true</xsl:text>
78 </xsl:when>
79 <xsl:otherwise>
80 <xsl:text>false</xsl:text>
81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:attribute>
84 </meta>
85
86 <!--
87 Insert description meta element. This is shown in searches and indexes
88 -->
89
90 <xsl:variable name="description">
91 <xsl:call-template name="hv1.description"/>
92 </xsl:variable>
93 <xsl:if test="$description != ''">
94 <meta name="Description">
95 <xsl:attribute name="content">
96 <xsl:call-template name="hv1.description"/>
97 </xsl:attribute>
98 </meta>
99 </xsl:if>
100
101 <!-- Display version of page -->
102 <xsl:variable name="display.version">
103 <xsl:call-template name="hv1.display.version"/>
104 </xsl:variable>
105 <xsl:if test="$display.version != ''">
106 <meta name="Microsoft.Help.DisplayVersion">
107 <xsl:attribute name="content">
108 <xsl:value-of select="$display.version"/>
109 </xsl:attribute>
110 </meta>
111 </xsl:if>
112
113 <!--
114 Content type is used to distinguish between multiple topics with same id.
115 Usualy to have multiple versions available
116 -->
117 <!--
118 <meta name="Microsoft.Help.ContentType">
119 <xsl:attribute name="content">
120 TODO: implement
121 </xsl:attribute>
122 </meta>
123 -->
124
125
126 <!-- If a product name is given, then mark each header with this name-->
127 <xsl:if test="$product.name and $product.name != ''">
128 <meta name="Microsoft.Help.Product">
129 <xsl:attribute name="content">
130 <xsl:value-of select="$product.name"/>
131 </xsl:attribute>
132 </meta>
133 </xsl:if>
134
135 <!-- If a version is given, then mark each header with version-->
136 <xsl:if test="$product.version and $product.version != ''">
137 <meta name="Microsoft.Help.ProductVersion">
138 <xsl:attribute name="content">
139 <xsl:value-of select="$product.version"/>
140 </xsl:attribute>
141 </meta>
142 </xsl:if>
143
144 <!--
145 Insert all keywords for this chunk. These are used
146 by the help runtime to generate indexes and refine search
147 -->
148 <xsl:call-template name="hv1.keywords" />
149
150 <!--
151 Insert all F1 ids for this chunk. This is used
152 by the help runtime to resolve F1 queries
153 -->
154 <xsl:call-template name="hv1.f1" />
155 </xsl:template>
156
157
158 <!-- There are links from ToC pane to bibliodivs, so there must be anchor -->
159 <xsl:template match="bibliodiv/title">
160 <h3 class="{name(.)}">
161 <xsl:call-template name="anchor">
162 <xsl:with-param name="node" select=".."/>
163 <xsl:with-param name="conditional" select="0"/>
164 </xsl:call-template>
165 <xsl:apply-templates/>
166 </h3>
167 </xsl:template>
168
169 <!--
170 Template to get a page id.
171
172 Needs to be unique in the target help system; microsoft uses UUIDs for this.
173 To avoid UUIDs and generate-id (only unique in current xml fragment),
174 we do
175 <root.filename> +
176 <last ancestor title> +
177 <second last ancestor title> +
178 ....
179 <self title>, where different types of sections/fragments
180 may be prefixed with a type identifier.
181
182 This should generate a fairly specific/unique ID.
183 -->
184 <xsl:template name="get.id.from.pagename">
185 <xsl:param name="target" />
186 <xsl:value-of select="$root.filename"/>
187 <xsl:variable name="id.of.document">
188 <xsl:apply-templates select="$target" mode="recursive-chunk-id"/>
189 </xsl:variable>
190 <xsl:variable name="titleWithSpace">
191 <xsl:value-of select="key('id',$id.of.document)/title"/>
192 </xsl:variable>
193 <xsl:value-of select="translate($id.of.document,' ','')" />
194 </xsl:template>
195
196 <!-- template that returns the page id used above -->
197 <xsl:template match="*" mode="recursive-chunk-id">
198 <xsl:param name="recursive" select="false()"/>
199
200 <!-- returns the filename of a chunk -->
201 <xsl:variable name="ischunk">
202 <xsl:call-template name="chunk"/>
203 </xsl:variable>
204
205 <xsl:variable name="dbhtml-filename">
206 <xsl:call-template name="pi.dbhtml_filename"/>
207 </xsl:variable>
208
209 <xsl:variable name="filename">
210 <xsl:choose>
211 <xsl:when test="$dbhtml-filename != ''">
212 <xsl:value-of select="$dbhtml-filename"/>
213 </xsl:when>
214 <!-- if this is the root element, use the root.filename -->
215 <xsl:when test="not(parent::*) and $root.filename != ''">
216 <xsl:value-of select="$root.filename"/>
217 <!-- <xsl:value-of select="$html.ext"/> -->
218 </xsl:when>
219 <!-- Special case -->
220 <xsl:when test="self::legalnotice and not($generate.legalnotice.link = 0)">
221 <xsl:choose>
222 <xsl:when test="(@id or @xml:id) and not($use.id.as.filename = 0)">
223 <!-- * if this legalnotice has an ID, then go ahead and use -->
224 <!-- * just the value of that ID as the basename for the file -->
225 <!-- * (that is, without prepending an "ln-" too it) -->
226 <xsl:value-of select="(@id|@xml:id)[1]"/>
227 <!-- <xsl:value-of select="$html.ext"/>-->
228 </xsl:when>
229 <xsl:otherwise>
230 <!-- * otherwise, if this legalnotice does not have an ID, -->
231 <!-- * then we generate an ID... -->
232 <xsl:variable name="id">
233 <xsl:call-template name="object.id"/>
234 </xsl:variable>
235 <!-- * ...and then we take that generated ID, prepend an -->
236 <!-- * "ln-" to it, and use that as the basename for the file -->
237 <!-- <xsl:value-of select="concat('ln-',$id,$html.ext)"/>-->
238 </xsl:otherwise>
239 </xsl:choose>
240 </xsl:when>
241 <!-- if there's no dbhtml filename, and if we're to use IDs as -->
242 <!-- filenames, then use the ID to generate the filename. -->
243 <xsl:when test="(@id or @xml:id) and $use.id.as.filename != 0">
244 <xsl:value-of select="(@id|@xml:id)[1]"/>
245 <!-- <xsl:value-of select="$html.ext"/>-->
246 </xsl:when>
247 <xsl:otherwise/>
248 </xsl:choose>
249 </xsl:variable>
250
251 <xsl:choose>
252 <xsl:when test="$ischunk='0'">
253 <!-- if called on something that isn't a chunk, walk up... -->
254 <xsl:choose>
255 <xsl:when test="count(parent::*)&gt;0">
256 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
257 <xsl:with-param name="recursive" select="$recursive"/>
258 </xsl:apply-templates>
259 </xsl:when>
260 <!-- unless there is no up, in which case return "" -->
261 <xsl:otherwise/>
262 </xsl:choose>
263 </xsl:when>
264
265 <xsl:when test="not($recursive) and $filename != ''">
266 <!-- if this chunk has an explicit name, use it -->
267 <xsl:value-of select="$filename"/>
268 </xsl:when>
269
270 <xsl:when test="self::set">
271 <xsl:value-of select="$root.filename"/>
272 </xsl:when>
273
274 <xsl:when test="self::book">
275 <xsl:text>bk</xsl:text>
276 <xsl:number level="any" format="01"/>
277 </xsl:when>
278
279 <xsl:when test="self::article">
280 <xsl:if test="/set">
281 <!-- in a set, make sure we inherit the right book info... -->
282 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
283 <xsl:with-param name="recursive" select="true()"/>
284 </xsl:apply-templates>
285 </xsl:if>
286
287 <xsl:text>ar</xsl:text>
288 <xsl:number level="any" format="01" from="book"/>
289 </xsl:when>
290
291 <xsl:when test="self::preface">
292 <xsl:if test="/set">
293 <!-- in a set, make sure we inherit the right book info... -->
294 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
295 <xsl:with-param name="recursive" select="true()"/>
296 </xsl:apply-templates>
297 </xsl:if>
298
299 <xsl:text>pr</xsl:text>
300 <xsl:number level="any" format="01" from="book"/>
301 </xsl:when>
302
303 <xsl:when test="self::chapter">
304 <xsl:if test="/set">
305 <!-- in a set, make sure we inherit the right book info... -->
306 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
307 <xsl:with-param name="recursive" select="true()"/>
308 </xsl:apply-templates>
309 </xsl:if>
310
311 <xsl:text>ch</xsl:text>
312 <xsl:number level="any" format="01" from="book"/>
313 </xsl:when>
314
315 <xsl:when test="self::appendix">
316 <xsl:if test="/set">
317 <!-- in a set, make sure we inherit the right book info... -->
318 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
319 <xsl:with-param name="recursive" select="true()"/>
320 </xsl:apply-templates>
321 </xsl:if>
322
323 <xsl:text>ap</xsl:text>
324 <xsl:number level="any" format="a" from="book"/>
325 </xsl:when>
326
327 <xsl:when test="self::part">
328 <xsl:choose>
329 <xsl:when test="/set">
330 <!-- in a set, make sure we inherit the right book info... -->
331 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
332 <xsl:with-param name="recursive" select="true()"/>
333 </xsl:apply-templates>
334 </xsl:when>
335 <xsl:otherwise>
336 </xsl:otherwise>
337 </xsl:choose>
338
339 <xsl:text>pt</xsl:text>
340 <xsl:number level="any" format="01" from="book"/>
341 </xsl:when>
342
343 <xsl:when test="self::reference">
344 <xsl:choose>
345 <xsl:when test="/set">
346 <!-- in a set, make sure we inherit the right book info... -->
347 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
348 <xsl:with-param name="recursive" select="true()"/>
349 </xsl:apply-templates>
350 </xsl:when>
351 <xsl:otherwise>
352 </xsl:otherwise>
353 </xsl:choose>
354
355 <xsl:text>rn</xsl:text>
356 <xsl:number level="any" format="01" from="book"/>
357 </xsl:when>
358
359 <xsl:when test="self::refentry">
360 <xsl:choose>
361 <xsl:when test="parent::reference">
362 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
363 <xsl:with-param name="recursive" select="true()"/>
364 </xsl:apply-templates>
365 </xsl:when>
366 <xsl:otherwise>
367 </xsl:otherwise>
368 </xsl:choose>
369
370 <xsl:text>re</xsl:text>
371 <xsl:number level="any" format="01" from="book"/>
372 </xsl:when>
373
374 <xsl:when test="self::colophon">
375 <xsl:choose>
376 <xsl:when test="/set">
377 <!-- in a set, make sure we inherit the right book info... -->
378 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
379 <xsl:with-param name="recursive" select="true()"/>
380 </xsl:apply-templates>
381 </xsl:when>
382 <xsl:otherwise>
383 </xsl:otherwise>
384 </xsl:choose>
385
386 <xsl:text>co</xsl:text>
387 <xsl:number level="any" format="01" from="book"/>
388 </xsl:when>
389
390 <xsl:when test="self::sect1
391 or self::sect2
392 or self::sect3
393 or self::sect4
394 or self::sect5
395 or self::section">
396 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
397 <xsl:with-param name="recursive" select="true()"/>
398 </xsl:apply-templates>
399 <xsl:text>s</xsl:text>
400 <xsl:number format="01"/>
401 </xsl:when>
402
403 <xsl:when test="self::bibliography">
404 <xsl:choose>
405 <xsl:when test="/set">
406 <!-- in a set, make sure we inherit the right book info... -->
407 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
408 <xsl:with-param name="recursive" select="true()"/>
409 </xsl:apply-templates>
410 </xsl:when>
411 <xsl:otherwise>
412 </xsl:otherwise>
413 </xsl:choose>
414
415 <xsl:text>bi</xsl:text>
416 <xsl:number level="any" format="01" from="book"/>
417 </xsl:when>
418
419 <xsl:when test="self::glossary">
420 <xsl:choose>
421 <xsl:when test="/set">
422 <!-- in a set, make sure we inherit the right book info... -->
423 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
424 <xsl:with-param name="recursive" select="true()"/>
425 </xsl:apply-templates>
426 </xsl:when>
427 <xsl:otherwise>
428 </xsl:otherwise>
429 </xsl:choose>
430
431 <xsl:text>go</xsl:text>
432 <xsl:number level="any" format="01" from="book"/>
433 </xsl:when>
434
435 <xsl:when test="self::index">
436 <xsl:choose>
437 <xsl:when test="/set">
438 <!-- in a set, make sure we inherit the right book info... -->
439 <xsl:apply-templates mode="recursive-chunk-id" select="parent::*">
440 <xsl:with-param name="recursive" select="true()"/>
441 </xsl:apply-templates>
442 </xsl:when>
443 <xsl:otherwise>
444 </xsl:otherwise>
445 </xsl:choose>
446
447 <xsl:text>ix</xsl:text>
448 <xsl:number level="any" format="01" from="book"/>
449 </xsl:when>
450
451 <xsl:when test="self::setindex">
452 <xsl:text>si</xsl:text>
453 <xsl:number level="any" format="01" from="set"/>
454 </xsl:when>
455
456 <xsl:otherwise>
457 <xsl:text>chunk-filename-error-</xsl:text>
458 <xsl:value-of select="name(.)"/>
459 <xsl:number level="any" format="01" from="set"/>
460 </xsl:otherwise>
461 </xsl:choose>
462 </xsl:template>
463
464 <!-- Main template that generates internal links -->
465 <xsl:template name="href.target">
466 <xsl:param name="context" select="."/>
467 <xsl:param name="object" select="."/>
468 <xsl:param name="toc-context" select="."/>
469
470 <xsl:variable name="id">
471 <xsl:call-template name="get.id.from.pagename">
472 <xsl:with-param name="target" select="$object"/>
473 </xsl:call-template>
474 </xsl:variable>
475
476 <xsl:variable name="href">
477 <xsl:choose>
478 <xsl:when test="$use.mshelp.links">
479 <!-- Generate a ms.help type link-->
480 <xsl:if test="$product.name = ''">
481 <xsl:message terminate="yes">
482 $product.name needs to be set to generate ms.help style links
483 </xsl:message>
484 </xsl:if>
485 <xsl:if test="$product.version = ''">
486 <xsl:message terminate="yes">
487 $product.version needs to be set to generate ms.help style links
488 </xsl:message>
489 </xsl:if>
490 <xsl:if test="$product.locale = ''">
491 <xsl:message terminate="yes">
492 $product.locale needs to be set to generate ms.help style links
493 </xsl:message>
494 </xsl:if>
495
496 <xsl:text>ms.help?method=page&amp;id=</xsl:text>
497 <xsl:value-of select="$id"/>
498 <xsl:text>&amp;product=</xsl:text>
499 <xsl:value-of select="$product.name"/>
500 <xsl:text>&amp;productVersion=</xsl:text>
501 <xsl:value-of select="$product.version"/>
502 <xsl:text>&amp;locale=</xsl:text>
503 <xsl:value-of select="$product.locale"/>
504 <!-- Append the jump id if the current object has an id-->
505 <xsl:if test="$object[@id or @xml:id]">
506 <xsl:text>#</xsl:text>
507 <xsl:value-of select="$object/@id|$object/@xml:id"/>
508 </xsl:if>
509 </xsl:when>
510 <xsl:otherwise>
511 <!-- Generate ms-xhelp type links. Default-->
512 <xsl:text>ms-xhelp:///?Id=</xsl:text>
513 <xsl:value-of select="$id"/>
514 </xsl:otherwise>
515 </xsl:choose>
516 </xsl:variable>
517 <xsl:value-of select="$href"/>
518 </xsl:template>
519
520 <xsl:template match="*" mode="common.html.attributes">
521 <xsl:param name="class" select="local-name(.)"/>
522 <xsl:param name="inherit" select="0"/>
523
524 <!--
525 Workaround for known issue with HelpLibAgent
526 Comment from Bruce Belson:
527 <pre> tags get their whitespace mangled by the Help Library Agent,
528 unless the non-standard attribute xml:space="preserve" is added to the pre element.
529 -->
530 <xsl:if test="$class = 'programlisting' or $class = 'verbatim' or $class = 'litterallayout' or $class = 'screen'">
531 <xsl:attribute name="xml:space">preserve</xsl:attribute>
532 </xsl:if>
533
534 <xsl:call-template name="generate.html.lang"/>
535 <xsl:call-template name="dir">
536 <xsl:with-param name="inherit" select="$inherit"/>
537 </xsl:call-template>
538 <xsl:apply-templates select="." mode="class.attribute">
539 <xsl:with-param name="class" select="$class"/>
540 </xsl:apply-templates>
541 </xsl:template>
542
543
544 <xsl:template name="hv1.display.version">
545 <xsl:apply-templates mode="title.markup" select="ancestor-or-self::book"/>
546 <xsl:if test="ancestor-or-self::chapter">
547 <xsl:text> - </xsl:text>
548 <xsl:apply-templates mode="title.markup" select="ancestor-or-self::chapter"/>
549 </xsl:if>
550 </xsl:template>
551
552
553 <!-- Generate a meta element for each keyword in chunk -->
554 <xsl:template name="hv1.keywords">
555 <xsl:variable name="is.chunk">
556 <xsl:call-template name="chunk">
557 <xsl:with-param name="node" select="."/>
558 </xsl:call-template>
559 </xsl:variable>
560
561 <xsl:for-each select=".//indexterm[$is.chunk = '0'] |
562 (./indexterm | *[not(self::section or self::preface or self::book or self::chapter)]//indexterm)[$is.chunk = '1']">
563 <xsl:choose>
564 <xsl:when test="primary != ''">
565 <meta name="Microsoft.Help.Keywords">
566 <xsl:attribute name="content">
567 <xsl:choose>
568 <!-- This concats the primary and secondary togheter, separated by colon if there exists
569 a tertiary element -->
570 <xsl:when test="tertiary">
571 <xsl:value-of select="primary/text()" />
572 <xsl:text>: </xsl:text>
573 <xsl:value-of select="secondary/text()" />
574 <xsl:text>, </xsl:text>
575 <xsl:value-of select="tertiary/text()" />
576 </xsl:when>
577
578 <xsl:otherwise>
579 <xsl:for-each select="primary/text() | secondary/text()">
580 <xsl:value-of select="." />
581 <xsl:if test="not(position() = last())">, </xsl:if>
582 </xsl:for-each>
583 </xsl:otherwise>
584 </xsl:choose>
585 </xsl:attribute>
586 </meta>
587 </xsl:when>
588 <xsl:otherwise/>
589 </xsl:choose>
590 </xsl:for-each>
591 </xsl:template>
592
593 <!-- Generate a F1 meta element for each indexterm with an ID (used as F1 id) -->
594 <xsl:template name="hv1.f1">
595 <xsl:variable name="is.chunk">
596 <xsl:call-template name="chunk">
597 <xsl:with-param name="node" select="."/>
598 </xsl:call-template>
599 </xsl:variable>
600
601 <xsl:variable name="id">
602 <xsl:call-template name="hv1.toc.id"/>
603 </xsl:variable>
604
605 <xsl:for-each select=".//indexterm[$is.chunk = '0'] |
606 (./indexterm | *[not(self::section or self::preface or self::book or self::chapter)]//indexterm)[$is.chunk = '1']">
607 <xsl:if test="@id|@xml:id">
608 <meta name="Microsoft.Help.F1">
609 <xsl:attribute name="content">
610 <xsl:value-of select="(@id|@xml:id)[1]" />
611 </xsl:attribute>
612 </meta>
613 </xsl:if>
614 </xsl:for-each>
615 </xsl:template>
616
617 <!-- ID used for to resolution. Using default ID -->
618 <xsl:template name="hv1.toc.id">
619 <xsl:variable name="href">
620 <xsl:call-template name="get.id.from.pagename">
621 <xsl:with-param name="target" select="."/>
622 </xsl:call-template>
623 </xsl:variable>
624 <xsl:value-of select="$href"/>
625 </xsl:template>
626
627 <!-- Determine parent id (if top level -> -1) -->
628 <xsl:template name="hv1.toc.parent.id">
629 <xsl:param name="up" select="''"/>
630 <xsl:variable name="href">
631 <xsl:choose>
632 <xsl:when test="$up">
633 <!-- I have a parent -->
634 <xsl:call-template name="get.id.from.pagename">
635 <xsl:with-param name="target" select="$up"/>
636 </xsl:call-template>
637 </xsl:when>
638 <xsl:otherwise>
639 <xsl:text>-1</xsl:text>
640 </xsl:otherwise>
641 </xsl:choose>
642 </xsl:variable>
643 <xsl:value-of select="$href"/>
644 </xsl:template>
645
646 <xsl:template name="hv1.description">
647 <xsl:variable name="content">
648 <xsl:choose>
649 <xsl:when test="abstract|d:abstract|d:info/d:abstract|bookinfo/abstract|sectioninfo/abstract|articleinfo/abstract|partinfo/abstract">
650 <xsl:value-of select="(abstract|d:abstract|d:info/d:abstract|bookinfo/abstract|sectioninfo/abstract|articleinfo/abstract|partinfo/abstract)[1]"/>
651 </xsl:when>
652 <xsl:when test="child::para">
653 <xsl:value-of select="substring(normalize-space(child::para[1]), 0, 150)"/>
654 </xsl:when>
655 <xsl:otherwise/>
656 </xsl:choose>
657 </xsl:variable>
658 <xsl:if test="$content != ''">
659 <xsl:value-of select="concat($content, '...')"/>
660 </xsl:if>
661 </xsl:template>
662
663
664 </xsl:stylesheet>