2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
5 <xsl:template name=
"add.annotation.links">
6 <xsl:param name=
"scripts" select=
"normalize-space($annotation.js)"/>
8 <xsl:when test=
"contains($scripts, ' ')">
9 <script type=
"text/javascript" src=
"{substring-before($scripts, ' ')}"/>
10 <xsl:call-template name=
"add.annotation.links">
11 <xsl:with-param name=
"scripts" select=
"substring-after($scripts, ' ')"/>
15 <script type=
"text/javascript" src=
"{$scripts}"/>
20 <xsl:template match=
"annotation"/>
22 <xsl:template name=
"apply-annotations">
23 <xsl:if test=
"$annotation.support != 0">
24 <!-- do any annotations apply to the context node? -->
25 <xsl:variable name=
"id" select=
"(@id|@xml:id)[1]"/>
27 <xsl:variable name=
"aids">
28 <xsl:for-each select=
"//annotation">
29 <xsl:if test=
"@annotates=$id
30 or starts-with(@annotates, concat($id, ' '))
31 or contains(@annotates, concat(' ', $id, ' '))
32 or substring(@annotates, string-length(@annotates)-3)
34 <xsl:value-of select=
"generate-id()"/>
35 <xsl:text> </xsl:text>
38 <xsl:if test=
"normalize-space(@annotations) != ''">
39 <xsl:call-template name=
"annotations-pointed-to">
40 <xsl:with-param name=
"annotations"
41 select=
"normalize-space(@annotations)"/>
46 <xsl:if test=
"$aids != ''">
47 <xsl:call-template name=
"apply-annotations-by-gid">
48 <xsl:with-param name=
"gids" select=
"normalize-space($aids)"/>
54 <xsl:template name=
"annotations-pointed-to">
55 <xsl:param name=
"annotations"/>
57 <xsl:when test=
"contains($annotations, ' ')">
58 <xsl:variable name='a'
59 select=
"key('id', substring-before($annotations, ' '))"/>
61 <xsl:value-of select=
"generate-id($a)"/>
62 <xsl:text> </xsl:text>
64 <xsl:call-template name=
"annotations-pointed-to">
65 <xsl:with-param name=
"annotations"
66 select=
"substring-after($annotations, ' ')"/>
70 <xsl:variable name='a'
71 select=
"key('id', $annotations)"/>
73 <xsl:value-of select=
"generate-id($a)"/>
74 <xsl:text> </xsl:text>
80 <xsl:template name=
"apply-annotations-by-gid">
81 <xsl:param name=
"gids"/>
84 <xsl:when test=
"contains($gids, ' ')">
85 <xsl:variable name=
"gid" select=
"substring-before($gids, ' ')"/>
86 <xsl:apply-templates select=
"key('gid', $gid)"
87 mode=
"annotation-inline"/>
88 <xsl:call-template name=
"apply-annotations-by-gid">
89 <xsl:with-param name=
"gids"
90 select=
"substring-after($gids, ' ')"/>
94 <xsl:apply-templates select=
"key('gid', $gids)"
95 mode=
"annotation-inline"/>
100 <xsl:template match=
"annotation" mode=
"annotation-inline">
101 <xsl:variable name=
"title">
103 <xsl:when test=
"title">
104 <xsl:value-of select=
"title"/>
107 <xsl:text>[Annotation #
</xsl:text>
108 <xsl:number count=
"annotation" level=
"any" format=
"1"/>
109 <xsl:text>]
</xsl:text>
114 <a href=
"#annot-{generate-id(.)}" title=
"{$title}"
115 name=
"anch-{generate-id(.)}" id=
"anch-{generate-id(.)}">
116 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
117 <xsl:attribute name=
"onClick">
118 <xsl:text>popup_
</xsl:text>
119 <xsl:value-of select=
"generate-id(.)"/>
120 <xsl:text>.showPopup('anch-
</xsl:text>
121 <xsl:value-of select=
"generate-id(.)"/>
122 <xsl:text>'); return false;
</xsl:text>
124 <img src=
"{$annotation.graphic.open}" border=
"0" alt=
"{$title}"/>
128 <xsl:template match=
"annotation" mode=
"annotation-popup">
129 <div class=
"annotation-nocss">
131 <a name=
"annot-{generate-id(.)}"/>
132 <xsl:text>Annotation #
</xsl:text>
133 <xsl:number count=
"annotation" level=
"any" format=
"1"/>
134 <xsl:text>:
</xsl:text>
138 <div id=
"popup-{generate-id(.)}" class=
"annotation-popup">
139 <xsl:if test=
"string-length(.) > 300">
140 <xsl:attribute name=
"style">width:
400px
</xsl:attribute>
143 <xsl:call-template name=
"annotation-title"/>
144 <div class=
"annotation-body">
145 <xsl:apply-templates select=
"*[local-name(.) != 'title']"/>
147 <div class=
"annotation-close">
148 <a href=
"#" onclick=
"popup_{generate-id(.)}.hidePopup();return false;">
149 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
150 <img src=
"{$annotation.graphic.close}" alt=
"X" border=
"0"/>
156 <xsl:template name=
"annotation-title">
157 <div class=
"annotation-title">
159 <xsl:when test=
"title">
160 <xsl:apply-templates select=
"title/node()"/>
163 <xsl:text>Annotation
</xsl:text>