Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
basex-freeze-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jerome Chauveau
basex-freeze-app
Commits
fed9d8f4
Commit
fed9d8f4
authored
5 months ago
by
Jerome Chauveau
Browse files
Options
Downloads
Patches
Plain Diff
remove useless code
parent
611b88aa
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/app.xqm
+27
-42
27 additions, 42 deletions
app/app.xqm
app/xsl/example.xsl
+31
-0
31 additions, 0 deletions
app/xsl/example.xsl
app/xsl/menu.xsl
+0
-189
0 additions, 189 deletions
app/xsl/menu.xsl
data/translations.xml
+0
-4
0 additions, 4 deletions
data/translations.xml
with
58 additions
and
235 deletions
app/app.xqm
+
27
−
42
View file @
fed9d8f4
xquery
version
"3.1"
;
module
namespace
app
=
"app"
;
(:declare:)
(:%rest:GET:)
(:%output:method("html"):)
(:%output:html-version('5'):)
(:%rest:path("/xsltinfos"):)
(:function app:xslt-infos(){:)
(: <ul>:)
(: <li>Processor : {xslt:processor()} </li>:)
(: <li>Version : {xslt:version()} </li>:)
(: </ul>:)
(:};:)
declare
%rest:GET
...
...
@@ -19,33 +8,18 @@ declare
%output:html-version
(
'5'
)
%rest:path
(
"/test"
)
function
app:test
(){
app:render
(
<p>
This
is
a
test
!
</p>
)
};
declare
%private
function
app:make-menu
(){
let
$transUrl
:=
request:scheme
()
||
'://'
||
request:hostname
()
||
':'
||
request:port
()
||
'/translations'
let
$xml
:=
db:get
(
'test'
,
'MANIFEST.xml'
)
return
xslt:transform
(
let
$content
:=
xslt:transform
(
$xml
,
doc
(
'xsl/menu.xsl'
)
,
map
{
'lang'
:
'fr'
,
'translationsUrl'
:
$transUrl
}
doc
(
'xsl/example.xsl'
)
,
map
{
'translationsUrl'
:
$transUrl
}
)
let
$menu
:=
xslt:transform
(
<dummy/>
,
doc
(
'xsl/example.xsl'
)
,
map
{
'translationsUrl'
:
$transUrl
}
)
};
declare
%rest:GET
%output:method
(
"html"
)
%output:html-version
(
'5'
)
%rest:path
(
"/translations"
)
function
app:get-translations
(){
db:get
(
'test'
,
'translations.xml'
)
};
declare
%private
function
app:render
(
$content
as
node
()){
let
$menu
:=
app:make-menu
()
return
<html
lang=
"en"
>
<head>
...
...
@@ -53,13 +27,24 @@ declare %private function app:render($content as node()){
<title>
Title
</title>
</head>
<body>
<nav>
{
$menu
}
</nav>
<nav>
{
$menu
}
</nav>
<main>
{
$content
}
</main>
</body>
</html>
};
declare
%rest:GET
%output:method
(
"html"
)
%output:html-version
(
'5'
)
%rest:path
(
"/translations"
)
function
app:get-translations
(){
db:get
(
'test'
,
'translations.xml'
)
};
This diff is collapsed.
Click to expand it.
app/xsl/example.xsl
0 → 100644
+
31
−
0
View file @
fed9d8f4
<xsl:stylesheet
version=
"3.1"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:mets=
"http://www.loc.gov/METS/"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
xmlns:i18n=
"app/test/i18n"
exclude-result-prefixes=
"xsl mets xlink i18n"
>
<xsl:output
method=
"xml"
indent=
"yes"
/>
<xsl:param
name=
"translationsUrl"
/>
<xsl:import
href=
"i18n.xsl"
/>
<xsl:template
match=
"/"
>
<section>
<xsl:apply-templates
select=
"//mets:div"
/>
</section>
</xsl:template>
<xsl:template
match=
"//mets:div"
>
<div>
<xsl:value-of
select=
"i18n:trans('hello', $translationsUrl)"
/>
</div>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/xsl/menu.xsl
deleted
100644 → 0
+
0
−
189
View file @
611b88aa
<xsl:stylesheet
version=
"3.1"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:mets=
"http://www.loc.gov/METS/"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
xmlns:i18n=
"app/test/i18n"
exclude-result-prefixes=
"xsl mets xlink i18n"
>
<xsl:output
method=
"xml"
indent=
"yes"
/>
<xsl:param
name=
"base_uri"
/>
<xsl:param
name=
"project_id"
/>
<xsl:param
name=
"lang"
/>
<xsl:param
name=
"with_index"
/>
<xsl:param
name=
"with_figure"
/>
<xsl:param
name=
"translationsUrl"
/>
<xsl:import
href=
"i18n.xsl"
/>
<xsl:template
match=
"/"
>
<xsl:apply-templates
select=
"//mets:structMap"
/>
</xsl:template>
<xsl:template
match=
"//mets:structMap"
>
<div
class=
"d-flex justify-content-between flex-grow-1"
>
<ul
class=
"navbar-nav"
>
<xsl:apply-templates
select=
"./mets:div[@TYPE='livre']/mets:div"
/>
<li
class=
"nav-item dropdown"
>
<a
class=
"nav-link dropdown-toggle"
href=
"#"
role=
"button"
data-bs-toggle=
"dropdown"
aria-expanded=
"true"
>
<xsl:value-of
select=
"i18n:trans('menu.navtools',translationsUrl)"
/>
</a>
<ul
class=
"dropdown-menu"
data-bs-popper=
"static"
>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"concat($base_uri, $project_id,'/',$lang,'/','plan.html')"
/>
</xsl:attribute>
<xsl:value-of
select=
"i18n:trans('menu.toc', $translationsUrl)"
/>
</a>
</li>
<xsl:if
test=
"$with_index='true'"
>
<li>
<a
class=
"nav-link"
>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"concat($base_uri, $project_id,'/',$lang,'/','g-index.html')"
/>
</xsl:attribute>
<xsl:value-of
select=
"i18n:trans('menu.index',$translationsUrl)"
/>
</a>
</li>
</xsl:if>
<xsl:if
test=
"$with_figure='true'"
>
<li>
<a
class=
"nav-link"
>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"concat($base_uri, $project_id,'/',$lang,'/','g-figures.html')"
/>
</xsl:attribute>
<xsl:value-of
select=
"i18n:trans('menu.figures', $translationsUrl)"
/>
</a>
</li>
</xsl:if>
</ul>
</li>
</ul>
</div>
</xsl:template>
<!-- entrées de menu de premier niveau -->
<xsl:template
match=
"//mets:div[@TYPE='livre']/mets:div[@LABEL]"
>
<li
class=
"nav-item"
data-type=
"livre"
>
<xsl:choose>
<!-- cas particulier de l'entrée de menu qui pointe vers la tdm @subtype=edition -->
<xsl:when
test=
"./[@TYPE]='edition'"
>
<a
class=
"nav-link"
data-type=
"toc"
>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"concat($base_uri, $project_id,'/',$lang,'/','sommaire/',string(@DMDID),'.html')"
/>
</xsl:attribute>
<xsl:attribute
name=
"data-tocid"
>
<xsl:value-of
select=
"string(@DMDID)"
/>
</xsl:attribute>
<xsl:value-of
select=
"i18n:trans(./@LABEL/data(), $translationsUrl)"
/>
</a>
</xsl:when>
<!-- entrée de menu avec lien direct vers fichier -->
<xsl:when
test=
"count(./mets:fptr)=1"
>
<a
class=
"nav-link"
aria-disabled=
"true"
>
<xsl:variable
name=
"pointer"
>
<xsl:value-of
select=
"./mets:fptr/@FILEID/data()"
/>
</xsl:variable>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"replace(concat($base_uri, $project_id,'/',$lang,'/',replace(./ancestor::*//mets:fileGrp[@ID='tei_files']/mets:file[@ID=$pointer]/mets:FLocat/@xlink:href/data(),'sources/','')),'.xml','.html')"
/>
</xsl:attribute>
<xsl:value-of
select=
"i18n:trans(./@LABEL/data(), $translationsUrl)"
/>
</a>
</xsl:when>
<!-- div avec des sous-divs -> dropdown menu -->
<xsl:when
test=
"count(./mets:div[@LABEL]) > 0"
>
<xsl:attribute
name=
"class"
>
<xsl:text>
nav-item dropdown
</xsl:text>
</xsl:attribute>
<a
class=
"nav-link dropdown-toggle"
href=
"#"
role=
"button"
data-bs-toggle=
"dropdown"
aria-expanded=
"false"
>
<xsl:value-of
select=
"i18n:trans(./@LABEL/data(), $translationsUrl)"
/>
</a>
<ul
class=
"dropdown-menu"
>
<xsl:apply-templates
select=
"./mets:div[@LABEL]"
/>
</ul>
</xsl:when>
<!-- index généré en entrée principal de menu -->
<xsl:when
test=
"count(./*) = 0 and @TYPE='index'"
>
<a
class=
"nav-link"
aria-disabled=
"true"
>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"concat($base_uri, $project_id, '/', $lang, '/indexes/', string(./@LABEL), '.html')"
/>
</xsl:attribute>
<xsl:attribute
name=
"data-type"
>
index
</xsl:attribute>
<xsl:value-of
select=
"i18n:trans(./@LABEL/data(), $translationsUrl)"
/>
</a>
</xsl:when>
</xsl:choose>
</li>
</xsl:template>
<!-- sous-entrées -->
<xsl:template
match=
"//mets:div[@TYPE='livre']/mets:div[@LABEL]//mets:div[@LABEL]"
>
<xsl:choose>
<xsl:when
test=
"@TYPE='souspartie'"
>
<li
class=
"nav-item"
data-type=
"souspartie"
>
<a
class=
"nav-link"
aria-disabled=
"true"
>
<xsl:attribute
name=
"href"
>
<xsl:variable
name=
"dmid"
>
<xsl:value-of
select=
"@DMDID"
/>
</xsl:variable>
<xsl:value-of
select=
"concat($base_uri, $project_id,'/',$lang,'/','sommaire/', $dmid, '.html')"
/>
</xsl:attribute>
<xsl:attribute
name=
"data-tocid"
><xsl:value-of
select=
"string(@DMDID)"
/></xsl:attribute>
<xsl:value-of
select=
"./@LABEL/data()"
/>
</a>
</li>
</xsl:when>
<xsl:otherwise>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
aria-disabled=
"true"
>
<xsl:if
test=
"./mets:fptr[@FILEID]"
>
<xsl:variable
name=
"pointer"
>
<xsl:value-of
select=
"./mets:fptr/@FILEID/data()"
/>
</xsl:variable>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"replace(replace(concat($base_uri,$project_id,'/',$lang,'/', ./ancestor::*//mets:fileGrp[@ID='tei_files']/mets:file[@ID=$pointer]/mets:FLocat/@xlink:href/data()),'.xml','.html'), 'sources/','')"
/>
</xsl:attribute>
<xsl:attribute
name=
"data-fileid"
><xsl:value-of
select=
"./mets:fptr/@FILEID"
/></xsl:attribute>
<xsl:attribute
name=
"data-href"
><xsl:value-of
select=
"./ancestor::*//mets:fileGrp[@ID='tei_files']/mets:file[@ID=$pointer]/mets:FLocat/@xlink:href/data()"
/></xsl:attribute>
</xsl:if>
<xsl:if
test=
"@TYPE='index'"
>
<xsl:attribute
name=
"href"
>
<xsl:value-of
select=
"concat($base_uri, $project_id, '/', $lang, '/indexes/', string(./@LABEL), '.html')"
/>
</xsl:attribute>
<xsl:attribute
name=
"data-type"
>
index
</xsl:attribute>
</xsl:if>
<xsl:value-of
select=
"i18n:trans(./@LABEL/data(), $translationsUrl)"
/>
</a>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/translations.xml
+
0
−
4
View file @
fed9d8f4
...
...
@@ -2,8 +2,4 @@
<translation
xml:lang=
"fr"
key=
"hello"
>
salut
</translation>
<translation
xml:lang=
"fr"
key=
"gm"
>
bonjour
</translation>
<translation
xml:lang=
"fr"
key=
"ge"
>
bonsoir
</translation>
<translation
xml:lang=
"fr"
key=
"meta.dir"
>
directeur
</translation>
<translation
xml:lang=
"fr"
key=
"meta.language"
>
directeur
</translation>
<translation
xml:lang=
"fr"
key=
"meta.abstract"
>
résumé
</translation>
<translation
xml:lang=
"fr"
key=
"meta.keywords"
>
mots-clés
</translation>
</translations>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment