Attachment 'contexts.xsl'
Download 1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0" xmlns="urn:Eclipse-Contexts-Schema"
3 xmlns:econtexts="urn:Eclipse-Contexts-Schema"
4 xmlns:wwtopics="urn:WebWorks-Topics-Schema"
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
7 xmlns:wwtoc="urn:WebWorks-Engine-TOC-Schema"
8 xmlns:wwlinks="urn:WebWorks-Engine-Links-Schema"
9 xmlns:wwmode="urn:WebWorks-Engine-Mode"
10 xmlns:wwfiles="urn:WebWorks-Engine-Files-Schema"
11 xmlns:wwdoc="urn:WebWorks-Document-Schema"
12 xmlns:wwbehaviors="urn:WebWorks-Behaviors-Schema"
13 xmlns:wwsplits="urn:WebWorks-Engine-Splits-Schema"
14 xmlns:wwproject="urn:WebWorks-Publish-Project"
15 xmlns:wwpage="urn:WebWorks-Page-Template-Schema"
16 xmlns:wwlocale="urn:WebWorks-Locale-Schema"
17 xmlns:wwprogress="urn:WebWorks-XSLT-Extension-Progress"
18 xmlns:wwlog="urn:WebWorks-XSLT-Extension-Log"
19 xmlns:wwfilesystem="urn:WebWorks-XSLT-Extension-FileSystem"
20 xmlns:wwuri="urn:WebWorks-XSLT-Extension-URI"
21 xmlns:wwstring="urn:WebWorks-XSLT-Extension-StringUtilities"
22 xmlns:wwfilesext="urn:WebWorks-XSLT-Extension-Files"
23 xmlns:wwprojext="urn:WebWorks-XSLT-Extension-Project"
24 xmlns:wwexsldoc="urn:WebWorks-XSLT-Extension-Document"
25 exclude-result-prefixes="wwtopics xsl msxsl wwtoc wwlinks wwmode wwfiles wwdoc wwbehaviors wwsplits wwproject wwpage wwlocale wwprogress wwlog wwfilesystem wwuri wwstring wwfilesext wwprojext wwexsldoc"
26 >
27 <xsl:param name="GlobalInput" />
28 <xsl:param name="GlobalPipelineName" />
29 <xsl:param name="GlobalProject" />
30 <xsl:param name="GlobalFiles" />
31 <xsl:param name="ParameterDependsType" />
32 <xsl:param name="ParameterSplitsType" />
33 <xsl:param name="ParameterType" />
34 <xsl:param name="ParameterContextsSplitFileType" />
35 <xsl:param name="ParameterUse" />
36 <xsl:param name="ParameterDeploy" />
37
38
39 <xsl:output encoding="UTF-8" indent="yes" />
40 <xsl:namespace-alias stylesheet-prefix="econtexts" result-prefix="#default" />
41 <xsl:strip-space elements="*" />
42
43
44 <xsl:key name="wwfiles-files-by-type" match="wwfiles:File" use="@type" />
45 <xsl:key name="wwsplits-files-by-type" match="wwsplits:File" use="@type" />
46 <xsl:key name="wwsplits-splits-by-id" match="wwsplits:Split" use="@id" />
47 <xsl:key name="wwtopics-topics-by-type" match="wwtopics:Topic" use="@type" />
48 <xsl:key name="wwtopics-topics-by-child-text" match="wwtopics:Topic" use="./wwtopics:Text/text()" />
49
50
51 <xsl:variable name="GlobalActionChecksum">
52 <xsl:variable name="VarTransformChecksums">
53 <xsl:value-of select="concat(wwuri:AsFilePath('wwtransform:self'), ':', wwfilesystem:GetChecksum(wwuri:AsFilePath('wwtransform:self')))" />
54 </xsl:variable>
55 <xsl:value-of select="wwstring:MD5Checksum($VarTransformChecksums)" />
56 </xsl:variable>
57
58
59 <xsl:template match="/">
60 <wwfiles:Files version="1.0">
61
62 <!-- Iterate input documents -->
63 <!-- -->
64 <xsl:for-each select="$GlobalFiles[1]">
65 <xsl:variable name="VarFilesByType" select="key('wwfiles-files-by-type', $ParameterDependsType)" />
66
67 <xsl:variable name="VarProgressStartFiles" select="wwprogress:Start(count($VarFilesByType))" />
68
69 <xsl:for-each select="$VarFilesByType">
70 <xsl:variable name="VarProgressStartFile" select="wwprogress:Start(1)" />
71
72 <xsl:variable name="VarFilesDocument" select="." />
73
74 <!-- Load splits -->
75 <!-- -->
76 <xsl:variable name="VarFilesSplits" select="key('wwfiles-files-by-type', $ParameterSplitsType)[@groupID = $VarFilesDocument/@groupID][1]" />
77 <xsl:variable name="VarSplits" select="wwexsldoc:LoadXMLWithoutResolver($VarFilesSplits/@path)" />
78
79 <xsl:for-each select="$VarSplits[1]">
80 <!-- Split -->
81 <!-- -->
82 <xsl:variable name="VarSplit" select="key('wwsplits-files-by-type', $ParameterContextsSplitFileType)[@groupID = $VarFilesDocument/@groupID][1]" />
83
84 <!-- Transform -->
85 <!-- -->
86 <xsl:variable name="VarUpToDate" select="wwfilesext:UpToDate($VarSplit/@path, '', $VarFilesDocument/@groupID, $VarFilesDocument/@documentID, $GlobalActionChecksum)" />
87 <xsl:if test="not($VarUpToDate)">
88 <xsl:variable name="VarResultAsXML">
89 <!-- Load document -->
90 <!-- -->
91 <xsl:variable name="VarContextTopics" select="wwexsldoc:LoadXMLWithoutResolver($VarFilesDocument/@path)" />
92
93 <xsl:call-template name="Contexts-Contexts">
94 <xsl:with-param name="ParamSplits" select="$VarSplits" />
95 <xsl:with-param name="ParamContextTopics" select="$VarContextTopics" />
96 <xsl:with-param name="ParamSplit" select="$VarSplit" />
97 </xsl:call-template>
98 </xsl:variable>
99 <xsl:variable name="VarResult" select="msxsl:node-set($VarResultAsXML)" />
100 <xsl:variable name="VarWriteResult" select="wwexsldoc:Document($VarResult, $VarSplit/@path, wwprojext:GetFormatSetting('encoding', 'utf-8'), 'xml', '1.0', 'yes')" />
101 </xsl:if>
102
103 <!-- Report Files -->
104 <!-- -->
105 <wwfiles:File path="{$VarSplit/@path}" type="{$ParameterType}" checksum="{wwfilesystem:GetChecksum($VarSplit/@path)}" projectchecksum="" groupID="{$VarFilesDocument/@groupID}" documentID="{$VarFilesDocument/@documentID}" actionchecksum="{$GlobalActionChecksum}" category="" use="{$ParameterUse}" deploy="{$ParameterDeploy}">
106 <wwfiles:Depends path="{$VarFilesSplits/@path}" checksum="{$VarFilesSplits/@checksum}" groupID="{$VarFilesSplits/@groupID}" documentID="{$VarFilesSplits/@documentID}" />
107 <wwfiles:Depends path="{$VarFilesDocument/@path}" checksum="{$VarFilesDocument/@checksum}" groupID="{$VarFilesDocument/@groupID}" documentID="{$VarFilesDocument/@documentID}" />
108 </wwfiles:File>
109 </xsl:for-each>
110
111 <xsl:variable name="VarProgressEndFile" select="wwprogress:End()" />
112 </xsl:for-each>
113
114 <xsl:variable name="VarProgressEndFiles" select="wwprogress:End()" />
115 </xsl:for-each>
116
117 </wwfiles:Files>
118 </xsl:template>
119
120
121 <xsl:template name="Contexts-Contexts">
122 <xsl:param name="ParamSplits" />
123 <xsl:param name="ParamContextTopics" />
124 <xsl:param name="ParamSplit" />
125
126 <xsl:processing-instruction name="NLS">
127 <xsl:text>TYPE="org.eclipse.help.contexts"</xsl:text>
128 </xsl:processing-instruction>
129
130 <!-- Define link root -->
131 <!-- -->
132 <xsl:variable name="VarLinkRoot">
133 <xsl:text>/</xsl:text>
134 <xsl:value-of select="wwprojext:GetFormatSetting('eclipse-help-id-prefix')" />
135 <xsl:text>.</xsl:text>
136 <xsl:value-of select="wwstring:EclipseId(wwprojext:GetGroupName($ParamSplit/@groupID))" />
137 <xsl:text>/</xsl:text>
138 </xsl:variable>
139
140 <econtexts:contexts>
141 <xsl:for-each select="$ParamContextTopics[1]">
142
143 <xsl:variable name="VarTopics" select="key('wwtopics-topics-by-type', 'topic') | key('wwtopics-topics-by-type', 'filename-and-topic')" />
144
145 <xsl:for-each select="$VarTopics">
146 <xsl:variable name="VarTopic" select="." />
147
148 <xsl:if test="count($VarTopic | $VarTopics[wwtopics:Text/text() = $VarTopic/wwtopics:Text/text()][1]) = 1">
149 <xsl:variable name="VarTopicText" select="$VarTopic/wwtopics:Text/text()" />
150
151 <xsl:variable name="VarDescription">
152 <!-- CUSTOM: Look for custom description -->
153 <xsl:choose>
154 <xsl:when test="string-length(substring-after($VarTopicText, '%')) > 0" >
155 <!-- Contains a custom description in the form '*%description' -->
156 <xsl:value-of select="substring-after($VarTopicText, '%')" />
157 </xsl:when>
158 <xsl:otherwise>
159 <!-- Use default -->
160 <xsl:choose>
161 <xsl:when test="$VarTopic/following-sibling::wwtopics:Topic[1]/@type = 'topic-description'">
162 <xsl:value-of select="$VarTopic/following-sibling::wwtopics:Topic[1]/wwtopics:Text/text()" />
163 </xsl:when>
164 <xsl:otherwise>
165 <xsl:value-of select="$VarTopic/following-sibling::wwtopics:ParagraphText/text()" />
166 </xsl:otherwise>
167 </xsl:choose>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:variable>
171
172 <xsl:variable name="VarTopicsByText" select="key('wwtopics-topics-by-child-text', $VarTopicText)" />
173
174 <!-- CUSTOM: Look for a custom ID -->
175 <xsl:variable name="VarContextID">
176 <xsl:choose>
177 <xsl:when test="contains($VarTopicText, ':')">
178 <!-- Contains a description 'id:*' -->
179 <xsl:value-of select="substring-before($VarTopicText, ':')" />
180 </xsl:when>
181 <xsl:when test="contains($VarTopicText, '%')">
182 <!-- Contains a description without a colon 'id%*' (bad form) -->
183 <xsl:value-of select="substring-before($VarTopicText, '%')" />
184 </xsl:when>
185 <xsl:otherwise>
186 <!-- Use default value -->
187 <xsl:value-of select="$VarTopicText" />
188 </xsl:otherwise>
189 </xsl:choose>
190 </xsl:variable>
191
192 <!-- CUSTOM: Look for custom label -->
193 <xsl:variable name="VarContextLabel">
194 <xsl:choose>
195 <xsl:when test="(contains($VarTopicText, ':')) and (contains($VarTopicText, '%'))" >
196 <!-- Contains an ID, label, and description 'id:label%description' -->
197 <xsl:value-of select="substring-before(substring-after($VarTopicText, ':'),'%')" />
198 </xsl:when>
199 <xsl:when test="contains($VarTopicText, ':')" >
200 <!-- No description, just ID and label 'id:label' -->
201 <xsl:value-of select="substring-after($VarTopicText, ':')" />
202 </xsl:when>
203 <xsl:otherwise>
204 <!-- Use default value, to be determined later -->
205 <xsl:value-of select="''" />
206 </xsl:otherwise>
207 </xsl:choose>
208 </xsl:variable>
209
210
211 <!-- CUSTOM: Use custom ID -->
212 <!-- Original line
213 <econtexts:context id="{$VarTopicText}">
214 -->
215 <econtexts:context id="{$VarContextID}" >
216 <econtexts:description><xsl:value-of select="$VarDescription" /></econtexts:description>
217
218 <xsl:for-each select="$VarTopicsByText">
219 <xsl:variable name="VarTopicByText" select="." />
220
221 <!-- Get topic split -->
222 <!-- -->
223 <xsl:for-each select="$ParamSplits[1]">
224 <xsl:variable name="VarTopicByTextSplit" select="key('wwsplits-splits-by-id', $VarTopicByText/@splitID)[@documentID = $VarTopicByText/@documentID][1]" />
225
226 <xsl:variable name="VarLinkTarget" select="wwuri:GetRelativeTo($VarTopicByTextSplit/@path, $ParamSplit/@path)" />
227
228 <xsl:variable name="VarAbsoluteLinkTarget">
229 <xsl:value-of select="$VarLinkRoot" />
230 <xsl:value-of select="$VarLinkTarget" />
231 </xsl:variable>
232
233 <!-- CUSTOM -->
234 <!-- Use custom label if it exists. -->
235 <xsl:choose>
236 <xsl:when test="string-length($VarContextLabel) > 0 " >
237 <econtexts:topic label="{$VarContextLabel}" href="{$VarAbsoluteLinkTarget}" />
238 </xsl:when>
239 <xsl:otherwise>
240 <econtexts:topic label="{$VarTopicByTextSplit/@title}" href="{$VarAbsoluteLinkTarget}" />
241 </xsl:otherwise>
242 </xsl:choose>
243
244 </xsl:for-each>
245 </xsl:for-each>
246 </econtexts:context>
247 </xsl:if>
248 </xsl:for-each>
249 </xsl:for-each>
250 </econtexts:contexts>
251 </xsl:template>
252 </xsl:stylesheet>
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.