Skip to content

Commit

Permalink
Merge pull request #52 from Det-Kongelige-Bibliotek/finally_capabilities
Browse files Browse the repository at this point in the history
Finally capabilities
  • Loading branch information
siglun committed May 15, 2018
2 parents 99ef83d + b91d7a0 commit 0382ecb
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 7 deletions.
4 changes: 4 additions & 0 deletions exporters/adl/solrize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<xsl:import href="../solrize-global.xsl"/>


<xsl:param name="subcollection" select="'adl'"/>

<xsl:param name="editor" >
<xsl:for-each select="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:respStmt">
<xsl:for-each select="t:resp">
Expand Down Expand Up @@ -45,4 +47,6 @@
</xsl:choose>
</xsl:param>

<xsl:template name="what_i_can"/>

</xsl:transform>
2 changes: 1 addition & 1 deletion exporters/common/present.xq
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ let $params :=
<param name="capabilities" value="{$capabilities}"/>
</parameters>

let $hdoc := transform:transform($doc,$op,$params)
let $hdoc := transform:transform($doc,$op,$params)
return
if(request:get-parameter("debug","")) then
<d>{$params,concat("./",$c,"/",$document),$hdoc}</d>
Expand Down
21 changes: 19 additions & 2 deletions exporters/common/solrize-global.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<xsl:param name="published_date" select="''"/>
<xsl:param name="c" select="'unknown_collection'"/>
<xsl:param name="url" select="concat($c,'/',$doc)"/>

<xsl:param name="subcollection" select="'adl'"/>
<xsl:param name="auid" select="''"/>
<xsl:param name="perioid" select="''"/>

Expand Down Expand Up @@ -436,6 +436,7 @@

<xsl:call-template name="extract_titles_authors_etc"/>

<xsl:call-template name="what_i_can"/>

<xsl:if test="$auid">
<xsl:element name="field">
Expand Down Expand Up @@ -478,7 +479,7 @@
</field>

<field name="subcollection_ssi">
<xsl:value-of select="$c"/>
<xsl:value-of select="$subcollection"/>
</field>

<xsl:call-template name="facs_and_text"/>
Expand Down Expand Up @@ -738,5 +739,21 @@
</xsl:choose>
</xsl:template>

<xsl:template name="what_i_can">
<xsl:if test="$capabilities and ($cap//t:ref|$cap//t:relatedItem)">
<xsl:element name="field">
<xsl:attribute name="name">capabilities_ssi</xsl:attribute>
<xsl:for-each select="$cap//t:ref|$cap//t:relatedItem">
<xsl:text>&lt;a href='</xsl:text><xsl:call-template name="inferred_path"><xsl:with-param name="document" select="@target"/></xsl:call-template><xsl:text>'></xsl:text><xsl:value-of select="@type"/><xsl:text>&lt;/a>
</xsl:text>
</xsl:for-each>
</xsl:element>
</xsl:if>
</xsl:template>

<xsl:template name="inferred_path">
<xsl:param name="document"/>
<xsl:value-of select="$document"/>
</xsl:template>

</xsl:transform>
3 changes: 3 additions & 0 deletions exporters/grundtvig/solrize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

<xsl:import href="../solrize-global.xsl"/>

<xsl:param name="subcollection" select="'grundtvig'"/>


<xsl:param name="worktitle">
<xsl:for-each select="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:title[not(@level) and not(@type)]">
<xsl:apply-templates mode="gettext" select="."/>
Expand Down
2 changes: 1 addition & 1 deletion exporters/holberg/creator-relations.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<table xmlns="http://www.tei-c.org/ns/1.0">
<row>
<cell role="author">authors/holberg--p-val.xml</cell>
<cell role="author">holberg--p-val.xml</cell>
<cell role="texts">
<ref>niels_klim.xml</ref>
<ref>niels_klim_overs.xml</ref>
Expand Down
22 changes: 21 additions & 1 deletion exporters/holberg/solrize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
exclude-result-prefixes="t">

<xsl:import href="../solrize-global.xsl"/>

<xsl:param name="subcollection" select="'holberg'"/>
<xsl:param name="category" select="'work'"/>

<xsl:param name="editor" >
Expand Down Expand Up @@ -45,6 +45,26 @@

</xsl:template>

<xsl:template name="inferred_path">
<xsl:param name="document" select="$doc"/>
<xsl:variable name="frag">
<xsl:choose>
<xsl:when test="contains($document,'#')">
<xsl:value-of select="substring-after($document,'#')"/>
</xsl:when>
<xsl:otherwise>root</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="f">
<xsl:choose>
<xsl:when test="$frag = 'root'">-</xsl:when>
<xsl:otherwise>-root#</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:text>/text/</xsl:text><xsl:value-of
select="translate(concat($c,'-',substring-before($doc,'/'),'/',substring-before($document,'.xml'),$f,$frag),'/','-')"/>
</xsl:template>


<xsl:template mode="backtrack" match="node()[@xml:id]">
<xsl:element name="field">
Expand Down
2 changes: 1 addition & 1 deletion exporters/pmm/creator-relations.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<table xmlns="http://www.tei-c.org/ns/1.0">
<row>
<cell role="author">authors/pmm-p-val.xml</cell>
<cell role="author">pmm-p-val.xml</cell>
<cell role="texts">
<ref>txt006.xml</ref>
<ref>txt063_1.xml</ref>
Expand Down
3 changes: 3 additions & 0 deletions exporters/pmm/solrize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
exclude-result-prefixes="t">

<xsl:import href="../solrize-global.xsl"/>
<xsl:param name="subcollection" select="'pmm'"/>

<xsl:param name="editor" >
<xsl:for-each select="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:respStmt">
Expand Down Expand Up @@ -59,4 +60,6 @@
<xsl:apply-templates mode="backtrack" select="ancestor::node()[@xml:id][1]"/>
</xsl:template>

<xsl:template name="what_i_can"/>

</xsl:transform>
4 changes: 3 additions & 1 deletion exporters/sks/solrize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
exclude-result-prefixes="t">

<xsl:import href="../solrize-global.xsl"/>

<xsl:param name="subcollection" select="'sks'"/>

<xsl:param name="volume_title">
<xsl:for-each select="/t:TEI/t:teiHeader/t:fileDesc/t:titleStmt/t:title[@level='s']">
<xsl:apply-templates mode="gettext" select="."/>
Expand Down Expand Up @@ -102,5 +103,6 @@
</xsl:choose>
</xsl:template>

<xsl:template name="what_i_can"/>

</xsl:transform>

0 comments on commit 0382ecb

Please sign in to comment.