Skip to content

Commit bd296ee

Browse files
committed
parameterize authority file paths and bibliography link URLs
1 parent 6f1c436 commit bd296ee

7 files changed

Lines changed: 77 additions & 25 deletions

global-parameters.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,35 @@
8282
<value>zotero</value> <!--looks at the api and renders the html from there-->
8383
</parameter>
8484

85+
<parameter> <!--base directory for authority files. Defaults to {user.dir}/webapps/ROOT/content/xml/authority/ in EFES if not set.-->
86+
<name>authority-dir</name>
87+
<value/>
88+
</parameter>
89+
8590
<parameter> <!--path to local TEI XML bibliography if this is the bibliography used-->
8691
<name>localbibl</name>
8792
<value>../BIBLIOGRAPHY.xml</value>
8893
</parameter>
94+
95+
<parameter> <!--path to symbols authority file. Defaults to {authority-dir}/symbols.xml if not set.-->
96+
<name>symbols-file</name>
97+
<value/>
98+
</parameter>
99+
100+
<parameter> <!--path to places authority file. Defaults to {authority-dir}/places.xml if not set.-->
101+
<name>places-file</name>
102+
<value/>
103+
</parameter>
104+
105+
<parameter> <!--path to institution authority file. Defaults to {authority-dir}/institution.xml if not set.-->
106+
<name>institutions-file</name>
107+
<value/>
108+
</parameter>
109+
110+
<parameter> <!--URL template for bibliography links. $1 is replaced by the entry ID.-->
111+
<name>bib-link-template</name>
112+
<value>../concordance/bibliography/$1.html</value>
113+
</parameter>
89114

90115
<parameter> if the zotero bibliography is used, select whether it is a group library or a user's library
91116
<name>ZoteroUorG</name>

global-varsandparams.xsl

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,27 @@
3838
select="document($param-file)//parameter[name = 'js-dir']/value"/>
3939
<xsl:param name="bibliography"
4040
select="document($param-file)//parameter[name = 'bibliography']/value[@on = 'yes']"/>
41-
<xsl:variable name="default-bibloc"
42-
select="concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/bibliography.xml')"/>
41+
42+
<!-- Base directory for authority files. Override to point at a different location. -->
43+
<xsl:variable name="raw-authority-dir"
44+
select="(document($param-file)//parameter[name = 'authority-dir']/value[. != ''], concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/'))[1]"/>
45+
<xsl:param name="authority-dir"
46+
select="if (ends-with($raw-authority-dir, '/')) then $raw-authority-dir else concat($raw-authority-dir, '/')"/>
47+
<!-- Individual authority file paths. Default to authority-dir + filename.
48+
Can be overridden individually via global-parameters.xml or as stylesheet params. -->
4349
<xsl:param name="localbibl"
44-
select="(document($param-file)//parameter[name = 'localbibl']/value[. != ''], $default-bibloc)[1]"/>
50+
select="(document($param-file)//parameter[name = 'localbibl']/value[. != ''], concat($authority-dir, 'bibliography.xml'))[1]"/>
51+
<xsl:param name="symbols-file"
52+
select="(document($param-file)//parameter[name = 'symbols-file']/value[. != ''], concat($authority-dir, 'symbols.xml'))[1]"/>
53+
<xsl:param name="places-file"
54+
select="(document($param-file)//parameter[name = 'places-file']/value[. != ''], concat($authority-dir, 'places.xml'))[1]"/>
55+
<xsl:param name="institutions-file"
56+
select="(document($param-file)//parameter[name = 'institutions-file']/value[. != ''], concat($authority-dir, 'institution.xml'))[1]"/>
57+
4558
<!-- URL template for bibliography links. $1 is replaced by the bibliography entry ID. -->
46-
<xsl:param name="bib-link-template" select="'../concordance/bibliography/$1.html'"/>
59+
<xsl:param name="bib-link-template"
60+
select="(document($param-file)//parameter[name = 'bib-link-template']/value[. != ''], '../concordance/bibliography/$1.html')[1]"/>
61+
4762
<xsl:param name="ZoteroUorG"
4863
select="document($param-file)//parameter[name = 'ZoteroUorG']/value[@on = 'yes']"/>
4964
<xsl:param name="ZoteroKey"

htm-teidivapparatus.xsl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,15 @@
242242
<xsl:param name="parm-edn-structure" tunnel="yes" required="no"/>
243243

244244
<xsl:param name="parm-leiden-style" tunnel="yes" required="no"/>
245+
<xsl:param name="parm-bibloc" tunnel="yes" required="no"/>
246+
<xsl:param name="parm-bib-link-template" tunnel="yes" required="no"/>
245247
<xsl:variable name="biblio" select="tokenize(substring-after(., '#'), ' #')"/>
246-
248+
247249
<xsl:choose>
248250
<xsl:when test="$parm-edn-structure=('inslib', 'sample') or $parm-leiden-style = 'medcyprus'">
249-
<xsl:variable name="bibliography-al" select="concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/bibliography.xml')"/>
251+
<xsl:variable name="bibliography-al" select="string($parm-bibloc)"/>
250252
<xsl:for-each select="$biblio">
251253
<xsl:variable name="bib" select="normalize-space(.)"/>
252-
<!-- if you are running this template outside EFES, change the path to the bibliography authority list accordingly -->
253254
<xsl:variable name="bibl">
254255
<xsl:if test="doc-available($bibliography-al)">
255256
<xsl:sequence select="document($bibliography-al)//t:bibl[@xml:id=$bib][not(@sameAs)]"></xsl:sequence>
@@ -258,7 +259,7 @@
258259
<xsl:if test="position()=1"><xsl:text> </xsl:text></xsl:if>
259260
<xsl:choose>
260261
<xsl:when test="doc-available($bibliography-al) and $bibl">
261-
<a href="../concordance/bibliography/{$bib}.html" target="_blank">
262+
<a href="{replace($parm-bib-link-template, '\$1', $bib)}" target="_blank">
262263
<xsl:choose>
263264
<xsl:when test="$bibl//t:bibl[@type='abbrev']">
264265
<xsl:apply-templates select="$bibl//t:bibl[@type='abbrev'][1]"/>

htm-tpl-struct-inslib.xsl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
</xsl:variable>
2020

2121
<xsl:template name="inslib-body-structure">
22+
<xsl:param name="parm-bibloc" tunnel="yes" required="no"/>
23+
<xsl:param name="parm-bib-link-template" tunnel="yes" required="no"/>
24+
<xsl:param name="parm-places-file" tunnel="yes" required="no"/>
2225
<div id="full-edition">
2326
<div id="edition-text">
2427
<xsl:call-template name="inslib-navigation"/>
@@ -239,12 +242,11 @@
239242
<xsl:if test="@source">
240243
<xsl:variable name="source-id" select="substring-after(@source, '#')"/>
241244
<p><xsl:text>Translation source: </xsl:text>
242-
<!-- if you are running this template outside EFES, change the path to the bibliography authority list accordingly -->
243-
<xsl:variable name="bibliography-al" select="concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/bibliography.xml')"/>
245+
<xsl:variable name="bibliography-al" select="string($parm-bibloc)"/>
244246
<xsl:choose>
245247
<xsl:when test="doc-available($bibliography-al) = fn:true() and document($bibliography-al)//t:bibl[@xml:id=$source-id][not(@sameAs)]">
246248
<xsl:variable name="source" select="document($bibliography-al)//t:bibl[@xml:id=$source-id][not(@sameAs)]"/>
247-
<a href="{concat('../concordance/bibliography/',$source-id,'.html')}" target="_blank">
249+
<a href="{replace($parm-bib-link-template, '\$1', $source-id)}" target="_blank">
248250
<xsl:choose>
249251
<xsl:when test="$source//t:bibl[@type='abbrev']">
250252
<xsl:apply-templates select="$source//t:bibl[@type='abbrev'][1]"/>
@@ -373,15 +375,14 @@
373375
</xsl:if>
374376

375377
<xsl:if test="$inslib-corpus='IGCyr'">
376-
<!-- if you are running this template outside EFES, change the path to the places authority list accordingly -->
377-
<xsl:if test="doc-available(concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/places.xml')) = fn:true()">
378+
<xsl:if test="doc-available(string($parm-places-file)) = fn:true()">
378379
<div id="maps">
379380
<h3>Maps</h3>
380381
<div class="row map_box">
381382
<div id="specific_map" class="map inscription_map"></div>
382383
<xsl:variable name="place-name" select="//t:provenance[@type='found'][1]//t:p[1]//t:placeName[@type='ancientFindspot'][1]"/>
383384
<xsl:variable name="place-id" select="//t:provenance[@type='found'][1]//t:p[1]//t:placeName[@type='ancientFindspot'][1]/@key"/>
384-
<xsl:variable name="places-al" select="document(concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/places.xml'))//t:place[descendant::t:placeName=$place-name][1]"/>
385+
<xsl:variable name="places-al" select="document(string($parm-places-file))//t:place[descendant::t:placeName=$place-name][1]"/>
385386
<xsl:variable name="counter" select="$places-al//t:note[@type='total_inscriptions']"/>
386387
<xsl:variable name="points" select="concat(string-join($place-name, ''), '#', string-join($counter, '') ,'@', substring-after(string-join($place-id, ''), 'slsgazetteer.org/'))"/>
387388
<script type="text/javascript">
@@ -542,9 +543,9 @@
542543
</xsl:template>
543544

544545
<xsl:template match="t:placeName|t:rs|t:repository" mode="inslib-placename">
546+
<xsl:param name="parm-institutions-file" tunnel="yes" required="no"/>
545547
<xsl:variable name="ref-id" select="substring-after(@ref, '#')"/>
546-
<!-- if you are running this template outside EFES, change the path to the institutions authority list accordingly -->
547-
<xsl:variable name="institutions-list" select="concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/institution.xml')"/>
548+
<xsl:variable name="institutions-list" select="string($parm-institutions-file)"/>
548549
<xsl:choose>
549550
<xsl:when test="contains(@ref,'institution.xml') and doc-available($institutions-list) = fn:true() and document($institutions-list)//t:place[@xml:id=$ref-id]//t:idno[1]">
550551
<a target="_blank" href="{document($institutions-list)//t:place[@xml:id=$ref-id]//t:idno[1]}"><xsl:apply-templates/></a>

htm-tpl-struct-medcyprus.xsl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
<!-- Called from htm-tpl-structure.xsl -->
1111

1212
<xsl:template name="medcyprus-body-structure">
13-
<xsl:variable name="editor" select="//t:titleStmt/t:author|//t:titleStmt/t:editor"/>
14-
<!-- if you are running this template outside EFES, change the path to the bibliography authority list accordingly -->
15-
<xsl:variable name="bibliography-al" select="concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/bibliography.xml')"/>
13+
<xsl:param name="parm-bibloc" tunnel="yes" required="no"/>
14+
<xsl:param name="parm-bib-link-template" tunnel="yes" required="no"/>
15+
<xsl:variable name="editor" select="//t:titleStmt/t:author|//t:titleStmt/t:editor"/>
16+
<xsl:variable name="bibliography-al" select="string($parm-bibloc)"/>
1617

1718
<p>
1819
<b>License: </b> <a target="_blank" href="{//t:licence/@target}"><xsl:value-of select="//t:licence"/></a>
@@ -119,7 +120,7 @@
119120
<xsl:choose>
120121
<xsl:when test="doc-available($bibliography-al) = fn:true() and document($bibliography-al)//t:bibl[@xml:id=$source-id][not(@sameAs)]">
121122
<xsl:variable name="source" select="document($bibliography-al)//t:bibl[@xml:id=$source-id][not(@sameAs)]"/>
122-
<a href="{concat('../concordance/bibliography/',$source-id,'.html')}" target="_blank">
123+
<a href="{replace($parm-bib-link-template, '\$1', $source-id)}" target="_blank">
123124
<xsl:choose>
124125
<xsl:when test="$source//t:title[@type='short']">
125126
<xsl:apply-templates select="$source//t:title[@type='short'][1]"/>
@@ -233,7 +234,7 @@
233234
<xsl:choose>
234235
<xsl:when test="doc-available($bibliography-al) = fn:true() and document($bibliography-al)//t:bibl[@xml:id=$source-id][not(@sameAs)]">
235236
<xsl:variable name="source" select="document($bibliography-al)//t:bibl[@xml:id=$source-id][not(@sameAs)]"/>
236-
<a href="../concordance/bibliography/{$source-id}.html" target="_blank">
237+
<a href="{replace($parm-bib-link-template, '\$1', $source-id)}" target="_blank">
237238
<xsl:choose>
238239
<xsl:when test="$source//t:title[@type='short']">
239240
<xsl:apply-templates select="$source//t:title[@type='short'][1]"/>

start-edition.xsl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@
124124
<xsl:with-param name="parm-bib" select="$bibliography" tunnel="yes"/>
125125
<xsl:with-param name="parm-bibloc" select="$localbibl" tunnel="yes"/>
126126
<xsl:with-param name="parm-bib-link-template" select="$bib-link-template" tunnel="yes"/>
127+
<xsl:with-param name="parm-symbols-file" select="$symbols-file" tunnel="yes"/>
128+
<xsl:with-param name="parm-places-file" select="$places-file" tunnel="yes"/>
129+
<xsl:with-param name="parm-institutions-file" select="$institutions-file" tunnel="yes"/>
130+
<xsl:with-param name="parm-authority-dir" select="$authority-dir" tunnel="yes"/>
127131
<xsl:with-param name="parm-zoteroUorG" select="$ZoteroUorG" tunnel="yes"/>
128132
<xsl:with-param name="parm-zoteroKey" select="$ZoteroKey" tunnel="yes"/>
129133
<xsl:with-param name="parm-zoteroNS" select="$ZoteroNS" tunnel="yes"/>

teig.xsl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
<xsl:param name="parm-leiden-style" tunnel="yes" required="no"></xsl:param>
2323
<xsl:param name="parm-edition-type" tunnel="yes" required="no"></xsl:param>
2424
<xsl:param name="parm-glyph-variant" tunnel="yes" required="no"></xsl:param>
25-
25+
<xsl:param name="parm-symbols-file" tunnel="yes" required="no"/>
26+
2627
<xsl:choose>
2728
<!-- **** TEMPORARY FIX FOR MEDCYPRUS TEMPLATE **** -->
2829
<xsl:when test="$parm-leiden-style=('medcyprus')">
2930
<xsl:variable name="symbol" select="substring-after(@ref,'#')"/>
30-
<!-- if you are running this template outside EFES, change the path to the symbols authority list accordingly -->
31-
<xsl:variable name="symbols-al" select="concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/symbols.xml')"/>
31+
<xsl:variable name="symbols-al" select="string($parm-symbols-file)"/>
3232
<xsl:choose>
3333
<xsl:when test="doc-available($symbols-al) = fn:true() and document($symbols-al)//t:glyph[@xml:id=$symbol]">
3434
<xsl:variable name="symbol-id" select="document($symbols-al)//t:glyph[@xml:id=$symbol]"/>
@@ -86,6 +86,7 @@
8686
<xsl:param name="parm-leiden-style" tunnel="yes" required="no"></xsl:param>
8787
<xsl:param name="parm-edition-type" tunnel="yes" required="no"></xsl:param>
8888
<xsl:param name="parm-glyph-variant" tunnel="yes" required="no"></xsl:param>
89+
<xsl:param name="parm-authority-dir" tunnel="yes" required="no"/>
8990

9091
<xsl:param name="g"></xsl:param>
9192

@@ -132,7 +133,11 @@
132133
<!-- ref may be a full string, or rather use a prefix, declared in prefixDecl, the xml:id assigned to the glyph may be thus without anchor, and needs to be reconstructed before-->
133134
<xsl:variable name="parsedRef" select="EDF:refParser(@ref, //t:listPrefixDef)"/>
134135

135-
<xsl:variable name="externalCharDecl" select="if ($parm-leiden-style='medcyprus') then concat('file:',system-property('user.dir'),'/webapps/ROOT/content/xml/authority/', substring-before($parsedRef, '#')) else substring-before($parsedRef, '#')"/>
136+
<xsl:variable name="externalCharDeclFile" select="substring-before($parsedRef, '#')"/>
137+
<xsl:variable name="externalCharDecl" select="
138+
if ($parm-authority-dir and doc-available(concat($parm-authority-dir, $externalCharDeclFile)))
139+
then concat($parm-authority-dir, $externalCharDeclFile)
140+
else $externalCharDeclFile"/>
136141
<xsl:choose>
137142
<xsl:when test="doc-available($externalCharDecl)">
138143
<xsl:variable name="externalCharDecldoc" select="doc($externalCharDecl)"/>

0 commit comments

Comments
 (0)