source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/annotations.xsl@ 1f51dd0

clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 1f51dd0 was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1<?xml version="1.0" encoding="ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6<xsl:template name="add.annotation.links">
7 <xsl:param name="scripts" select="normalize-space($annotation.js)"/>
8 <xsl:choose>
9 <xsl:when test="contains($scripts, ' ')">
10 <script type="text/javascript" src="{substring-before($scripts, ' ')}"/>
11 <xsl:call-template name="add.annotation.links">
12 <xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
13 </xsl:call-template>
14 </xsl:when>
15 <xsl:otherwise>
16 <script type="text/javascript" src="{$scripts}"/>
17 </xsl:otherwise>
18 </xsl:choose>
19</xsl:template>
20
21<xsl:template match="annotation"/>
22
23<xsl:template name="apply-annotations">
24 <xsl:if test="$annotation.support != 0">
25 <!-- do any annotations apply to the context node? -->
26 <xsl:variable name="id" select="(@id|@xml:id)[1]"/>
27
28 <xsl:variable name="aids">
29 <xsl:for-each select="//annotation">
30 <xsl:if test="@annotates=$id or starts-with(@annotates, concat($id, ' ')) or contains(@annotates, concat(' ', $id, ' ')) or substring(@annotates, string-length(@annotates)-3) = concat(' ', $id)">
31 <xsl:value-of select="generate-id()"/>
32 <xsl:text> </xsl:text>
33 </xsl:if>
34 </xsl:for-each>
35 <xsl:if test="normalize-space(@annotations) != ''">
36 <xsl:call-template name="annotations-pointed-to">
37 <xsl:with-param name="annotations" select="normalize-space(@annotations)"/>
38 </xsl:call-template>
39 </xsl:if>
40 </xsl:variable>
41
42 <xsl:if test="$aids != ''">
43 <xsl:call-template name="apply-annotations-by-gid">
44 <xsl:with-param name="gids" select="normalize-space($aids)"/>
45 </xsl:call-template>
46 </xsl:if>
47 </xsl:if>
48</xsl:template>
49
50<xsl:template name="annotations-pointed-to">
51 <xsl:param name="annotations"/>
52 <xsl:choose>
53 <xsl:when test="contains($annotations, ' ')">
54 <xsl:variable name="a" select="key('id', substring-before($annotations, ' '))"/>
55 <xsl:if test="$a">
56 <xsl:value-of select="generate-id($a)"/>
57 <xsl:text> </xsl:text>
58 </xsl:if>
59 <xsl:call-template name="annotations-pointed-to">
60 <xsl:with-param name="annotations" select="substring-after($annotations, ' ')"/>
61 </xsl:call-template>
62 </xsl:when>
63 <xsl:otherwise>
64 <xsl:variable name="a" select="key('id', $annotations)"/>
65 <xsl:if test="$a">
66 <xsl:value-of select="generate-id($a)"/>
67 <xsl:text> </xsl:text>
68 </xsl:if>
69 </xsl:otherwise>
70 </xsl:choose>
71</xsl:template>
72
73<xsl:template name="apply-annotations-by-gid">
74 <xsl:param name="gids"/>
75
76 <xsl:choose>
77 <xsl:when test="contains($gids, ' ')">
78 <xsl:variable name="gid" select="substring-before($gids, ' ')"/>
79 <xsl:apply-templates select="key('gid', $gid)" mode="annotation-inline"/>
80 <xsl:call-template name="apply-annotations-by-gid">
81 <xsl:with-param name="gids" select="substring-after($gids, ' ')"/>
82 </xsl:call-template>
83 </xsl:when>
84 <xsl:otherwise>
85 <xsl:apply-templates select="key('gid', $gids)" mode="annotation-inline"/>
86 </xsl:otherwise>
87 </xsl:choose>
88</xsl:template>
89
90<xsl:template match="annotation" mode="annotation-inline">
91 <xsl:variable name="title">
92 <xsl:choose>
93 <xsl:when test="title">
94 <xsl:value-of select="title"/>
95 </xsl:when>
96 <xsl:otherwise>
97 <xsl:text>[Annotation #</xsl:text>
98 <xsl:number count="annotation" level="any" format="1"/>
99 <xsl:text>]</xsl:text>
100 </xsl:otherwise>
101 </xsl:choose>
102 </xsl:variable>
103
104 <a id="anch-{generate-id(.)}" href="#annot-{generate-id(.)}" title="{$title}">
105 <xsl:apply-templates select="." mode="class.attribute"/>
106 <xsl:attribute name="onClick">
107 <xsl:text>popup_</xsl:text>
108 <xsl:value-of select="generate-id(.)"/>
109 <xsl:text>.showPopup('anch-</xsl:text>
110 <xsl:value-of select="generate-id(.)"/>
111 <xsl:text>'); return false;</xsl:text>
112 </xsl:attribute>
113 <img src="{$annotation.graphic.open}" border="0" alt="{$title}"/>
114 </a>
115</xsl:template>
116
117<xsl:template match="annotation" mode="annotation-popup">
118 <div class="annotation-nocss">
119 <p>
120 <a id="annot-{generate-id(.)}"/>
121 <xsl:text>Annotation #</xsl:text>
122 <xsl:number count="annotation" level="any" format="1"/>
123 <xsl:text>:</xsl:text>
124 </p>
125 </div>
126
127 <div id="popup-{generate-id(.)}" class="annotation-popup">
128 <xsl:if test="string-length(.) &gt; 300">
129 <xsl:attribute name="style">width:400px</xsl:attribute>
130 </xsl:if>
131
132 <xsl:call-template name="annotation-title"/>
133 <div class="annotation-body">
134 <xsl:apply-templates select="*[local-name(.) != 'title']"/>
135 </div>
136 <div class="annotation-close">
137 <a href="#" onclick="popup_{generate-id(.)}.hidePopup();return false;">
138 <xsl:apply-templates select="." mode="class.attribute"/>
139 <img src="{$annotation.graphic.close}" alt="X" border="0"/>
140 </a>
141 </div>
142 </div>
143</xsl:template>
144
145<xsl:template name="annotation-title">
146 <div class="annotation-title">
147 <xsl:choose>
148 <xsl:when test="title">
149 <xsl:apply-templates select="title/node()"/>
150 </xsl:when>
151 <xsl:otherwise>
152 <xsl:text>Annotation</xsl:text>
153 </xsl:otherwise>
154 </xsl:choose>
155 </div>
156</xsl:template>
157
158</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.