@@ -132,13 +132,124 @@ extension-element-prefixes="ixsl"
132132 </div >
133133 </xsl : template >
134134
135+ <!-- ACTION BAR -->
136+
137+ <xsl : template match =" rdf:RDF" mode =" bs2:ActionBarLeft" >
138+ <xsl : param name =" id" as =" xs:string?" />
139+ <xsl : param name =" class" select =" 'span2'" as =" xs:string?" />
140+
141+ <div >
142+ <xsl : if test =" $id" >
143+ <xsl : attribute name =" id" select =" $id" />
144+ </xsl : if >
145+ <xsl : if test =" $class" >
146+ <xsl : attribute name =" class" select =" $class" />
147+ </xsl : if >
148+
149+ <xsl : if test =" acl:mode() = '&acl; Write' and not(key('resources-by-type', '&http; Response'))" >
150+ <!-- child documents can be created only if the current document is the Root or a container -->
151+ <xsl : if test =" key('resources', ac:absolute-path(ldh:base-uri(.)))/rdf:type/@rdf:resource = ('&def; Root', '&dh; Container')" >
152+ <xsl : variable name =" document-classes" select =" key('resources', ('&dh; Container', '&dh; Item'), document(ac:document-uri('&def; ')))" as =" element()*" />
153+ <xsl : apply-templates select =" ." mode =" bs2:Create" >
154+ <xsl : with-param name =" class" select =" 'btn-group pull-left'" />
155+ <xsl : with-param name =" classes" select =" $document-classes" />
156+ <xsl : with-param name =" create-graph" select =" true()" />
157+ <xsl : with-param name =" show-instance" select =" false()" />
158+ </xsl : apply-templates >
159+ </xsl : if >
160+ </xsl : if >
161+
162+ <xsl : if test =" $ldh:ajaxRendering" >
163+ <xsl : apply-templates select =" ." mode =" bs2:AddData" />
164+ </xsl : if >
165+ </div >
166+ </xsl : template >
167+
168+ <xsl : template match =" rdf:RDF | srx:sparql" mode =" bs2:ActionBarMain" >
169+ <xsl : param name =" id" as =" xs:string?" />
170+ <xsl : param name =" class" select =" 'span7'" as =" xs:string?" />
171+
172+ <div >
173+ <xsl : if test =" $id" >
174+ <xsl : attribute name =" id" select =" $id" />
175+ </xsl : if >
176+ <xsl : if test =" $class" >
177+ <xsl : attribute name =" class" select =" $class" />
178+ </xsl : if >
179+
180+ <div class =" row-fluid" >
181+ <xsl : apply-templates select =" ." mode =" bs2:BreadCrumbBar" >
182+ <xsl : with-param name =" id" select =" 'breadcrumb-nav'" />
183+ <xsl : with-param name =" uri" select =" ac:absolute-path(ldh:base-uri(.))" />
184+ </xsl : apply-templates >
185+
186+ <div id =" doc-controls" class =" span4" >
187+ <xsl : apply-templates select =" key('resources', ac:absolute-path(ldh:base-uri(.)))" mode =" bs2:Timestamp" />
188+ </div >
189+ </div >
190+ </div >
191+ </xsl : template >
192+
193+ <xsl : template match =" rdf:RDF | srx:sparql" mode =" bs2:ActionBarRight" >
194+ <xsl : param name =" id" as =" xs:string?" />
195+ <xsl : param name =" class" select =" 'span3'" as =" xs:string?" />
196+ <xsl : param name =" active-mode" as =" xs:anyURI" />
197+
198+ <div >
199+ <xsl : if test =" $id" >
200+ <xsl : attribute name =" id" select =" $id" />
201+ </xsl : if >
202+ <xsl : if test =" $class" >
203+ <xsl : attribute name =" class" select =" $class" />
204+ </xsl : if >
205+
206+ <xsl : apply-templates select =" ." mode =" bs2:MediaTypeList" >
207+ <xsl : with-param name =" uri" select =" ac:absolute-path(ldh:base-uri(.))" />
208+ </xsl : apply-templates >
209+
210+ <xsl : apply-templates select =" ." mode =" bs2:NavBarActions" />
211+
212+ <xsl : apply-templates select =" ." mode =" bs2:ModeList" >
213+ <xsl : with-param name =" active-mode" select =" $active-mode" />
214+ <xsl : with-param name =" ajax-rendering" select =" $ldh:ajaxRendering" />
215+ </xsl : apply-templates >
216+ </div >
217+ </xsl : template >
218+
219+ <xsl : template match =" rdf:RDF" mode =" bs2:BreadCrumbBar" >
220+ <xsl : param name =" id" as =" xs:string?" />
221+ <xsl : param name =" class" select =" 'span8'" as =" xs:string?" />
222+ <xsl : param name =" uri" as =" xs:string?" />
223+
224+ <div >
225+ <xsl : if test =" $id" >
226+ <xsl : attribute name =" id" select =" $id" />
227+ </xsl : if >
228+ <xsl : if test =" $class" >
229+ <xsl : attribute name =" class" select =" $class" />
230+ </xsl : if >
231+
232+ <!-- placeholder for client.xsl callbacks -->
233+
234+ <xsl : if test =" not($ldh:ajaxRendering)" >
235+ <ul class =" breadcrumb pull-left" >
236+ <!-- render breadcrumbs server-side -->
237+ <xsl : apply-templates select =" key('resources', $uri)" mode =" bs2:BreadCrumbListItem" />
238+ </ul >
239+ </xsl : if >
240+ </div >
241+ </xsl : template >
242+
243+ <xsl : template match =" srx:sparql" mode =" bs2:BreadCrumbBar" />
244+
135245 <!-- MODE LIST -->
136246
247+ <xsl : template match =" rdf:RDF[key('resources-by-type', '&http;Response')][not(key('resources-by-type', '&spin;ConstraintViolation'))] | rdf:RDF[key('resources-by-type', '&http;Response')][not(key('resources-by-type', '&sh;ValidationResult'))]" mode =" bs2:ModeList" priority =" 1" />
248+
137249 <xsl : template match =" rdf:RDF" mode =" bs2:ModeList" priority =" 2" use-when =" system-property('xsl:product-name') = 'SAXON'" >
138- <xsl : param name =" has-content" as =" xs:boolean" />
139- <xsl : param name =" active-mode" as =" xs:anyURI?" />
250+ <xsl : param name =" active-mode" as =" xs:anyURI" />
140251 <xsl : param name =" ajax-rendering" select =" true()" as =" xs:boolean" />
141- <xsl : param name =" absolute-path" select =" ac:absolute-path(ldh:request -uri())" as =" xs:anyURI" />
252+ <xsl : param name =" absolute-path" select =" ac:absolute-path(ldh:base -uri(. ))" as =" xs:anyURI" />
142253 <xsl : param name =" base-uri" select =" ldh:base-uri(.)" as =" xs:anyURI" />
143254 <xsl : param name =" id" select =" 'layout-modes'" as =" xs:string?" />
144255
@@ -148,16 +259,15 @@ extension-element-prefixes="ixsl"
148259 <xsl : attribute name =" id" select =" $id" />
149260 </xsl : if >
150261
151- <xsl : variable name =" effective-mode" select =" if ($active-mode) then $active-mode else '∾ ReadMode'" as =" xs:anyURI" />
152- <xsl : apply-templates select =" key('resources', $effective-mode, document(ac:document-uri(string($effective-mode))))" mode =" ldh:logo" >
262+ <xsl : apply-templates select =" key('resources', $active-mode, document(ac:document-uri(string($active-mode))))" mode =" ldh:logo" >
153263 <xsl : with-param name =" class" select =" 'btn dropdown-toggle'" />
154264 </xsl : apply-templates >
155265 <xsl : text > </xsl : text >
156266 <span class =" caret" ></span >
157267 </button >
158268
159269 <ul class =" dropdown-menu" >
160- <li class =" content-mode{if ((empty($active-mode) and $has-content) or $active-mode = '&ldh; ContentMode') then ' active' else() }" >
270+ <li class =" content-mode{if ($active-mode = '&ldh; ContentMode') then ' active' else() }" >
161271 <a href =" {ldh:href(ac:document-uri(ldh:base-uri(.)), ldh:query-params(xs:anyURI('&ldh; ContentMode')))}" >
162272 <xsl : apply-templates select =" key('resources', '&ldh; ContentMode', document(ac:document-uri('&ldh; ')))" mode =" ldh:logo" />
163273 <xsl : value-of >
@@ -166,20 +276,52 @@ extension-element-prefixes="ixsl"
166276 </a >
167277 </li >
168278
169- <xsl : for-each select =" ('∾ ReadMode', '∾ MapMode', if ($ajax-rendering) then '∾ ChartMode' else () , '∾ GraphMode')" >
279+ <xsl : for-each select =" ('∾ ReadMode', '∾ MapMode', if ($ajax-rendering) then ( '∾ ChartMode', '∾ GraphMode') else () )" >
170280 <xsl : variable name =" mode-uri" select =" ." as =" xs:string" />
171281 <xsl : for-each select =" key('resources', $mode-uri, document(ac:document-uri('∾ ')))" >
172282 <xsl : apply-templates select =" ." mode =" bs2:ModeListItem" >
173- <xsl : with-param name =" active" select =" if (@rdf:about = ' ∾ ReadMode') then (@rdf:about = $active-mode or (empty($active-mode) and not($has-content))) else @rdf:about = $active-mode" />
283+ <xsl : with-param name =" active" select =" @rdf:about = $active-mode" />
174284 <xsl : with-param name =" absolute-path" select =" $absolute-path" tunnel =" yes" />
175285 <xsl : with-param name =" base-uri" select =" $base-uri" />
176286 </xsl : apply-templates >
177287 </xsl : for-each >
178288 </xsl : for-each >
179289 </ul >
180290 </div >
181- </xsl : template >
291+ </xsl : template >
182292
293+ <!-- MEDIA TYPE LIST -->
294+
295+ <xsl : template match =" rdf:RDF | srx:sparql" mode =" bs2:MediaTypeList" priority =" 1" >
296+ <xsl : param name =" uri" as =" xs:anyURI" />
297+
298+ <div class =" btn-group pull-right" >
299+ <button type =" button" id =" export-rdf" title =" {ac:label(key('resources', 'nav-bar-action-export-rdf-title', document('translations.rdf')))}" >
300+ <xsl : apply-templates select =" key('resources', '∾ Export', document(ac:document-uri('∾ ')))" mode =" ldh:logo" >
301+ <xsl : with-param name =" class" select =" 'btn dropdown-toggle'" />
302+ </xsl : apply-templates >
303+
304+ <xsl : apply-templates select =" key('resources', '∾ Export', document(ac:document-uri('∾ ')))" mode =" ac:label" />
305+
306+ <span class =" caret" ></span >
307+ </button >
308+ <ul class =" dropdown-menu" >
309+ <li >
310+ <xsl : variable name =" href" select =" ac:build-uri(ac:absolute-path(ldh:request-uri()), let $params := map{ 'accept': 'application/rdf+xml' } return if (ac:uri()) then map:merge(($params, map{ 'uri': string($uri) })) else $params)" as =" xs:anyURI" />
311+ <a href =" {$href}" title =" application/rdf+xml" target =" _blank" >RDF/XML</a >
312+ </li >
313+ <li >
314+ <xsl : variable name =" href" select =" ac:build-uri(ac:absolute-path(ldh:request-uri()), let $params := map{ 'accept': 'text/turtle' } return if (ac:uri()) then map:merge(($params, map{ 'uri': string($uri) })) else $params)" as =" xs:anyURI" />
315+ <a href =" {$href}" title =" text/turtle" target =" _blank" >Turtle</a >
316+ </li >
317+ <li >
318+ <xsl : variable name =" href" select =" ac:build-uri(ac:absolute-path(ldh:request-uri()), let $params := map{ 'accept': 'application/ld+json' } return if (ac:uri()) then map:merge(($params, map{ 'uri': string($uri) })) else $params)" as =" xs:anyURI" />
319+ <a href =" {$href}" title =" application/ld+json" target =" _blank" >JSON-LD</a >
320+ </li >
321+ </ul >
322+ </div >
323+ </xsl : template >
324+
183325 <!-- CONTENT BODY -->
184326
185327 <xsl : template match =" rdf:RDF[exists($ldh:requestUri) and key('resources-by-type', '&http;Response') and not(key('resources-by-type', '&spin;ConstraintViolation')) and not(key('resources-by-type', '&sh;ValidationResult'))]" mode =" bs2:ContentBody" priority =" 1" >
0 commit comments