Skip to content

Commit

Permalink
#68: Update README, avoid calling PHP from the XSL transform when not…
Browse files Browse the repository at this point in the history
… needed
  • Loading branch information
ctgraham committed Sep 10, 2021
1 parent f5eebbd commit af72881
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ In `charlie`, we have three logical containers:

Do note that the code tries not to make any assumptions about the numbering of boxes or folders. Folders could either be numbered sequentially across boxes (in which case specifying a range of folders could make sense when specifying a range of boxes) or specific to a box. Additionally, pluralization of types is largely ignored.

### Q. How are links generated from the Finding Aid to digitized objects?

A. Links will be generated from the EAD rendering to digitized objects in one or more of two ways:

1) If the child objects have Solr metadata which points to the EAD object, box identifier, folder identifier, and component id, search queries will be formulated from the Finding Aid to the matching digital objects. This is configured in the settings form, under the heading "Link Objects by Query".

2) If the DAOs in the EAD have links in the xlink namespace which point to paths identifying the digital objects, these URIs can be embedded (with an optional prefix) within the Finding Aid display. Examples could be where the DAO's href might point to a link resolver, a DOI, relative or absolute URI, or a Fedora PID. This is configured in the settings form, under the heading "Link Objects by DAO xlink".

## Maintainers/Sponsors
Current maintainers:

Expand Down
2 changes: 2 additions & 0 deletions theme/theme.inc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ function template_preprocess_islandora_manuscript_ead_display(&$variables) {
$variables['xslt_parameters'][''] = (isset($variables['xslt_parameters']['']) ? $variables['xslt_parameters'][''] : array()) + array(
"container_string" => t('Containers'),
);
$variables['xslt_parameters']['']['call_query_link'] = variable_get('islandora_manuscript_query_enable', true) ? 'true' : 'false';
$variables['xslt_parameters']['']['call_direct_link'] = variable_get('islandora_manuscript_direct_enable', false) ? 'true' : false;
$variables['doc'] = $doc = new DOMDocument();
$doc->loadXML($variables['object']['EAD']->content);

Expand Down
29 changes: 22 additions & 7 deletions transforms/ead_to_html.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
>
<xsl:param name="container_string">Containers</xsl:param>

<xsl:param name="call_query_link" />
<xsl:param name="call_direct_link" />

<xsl:template match="/">
<div class="ead">
<xsl:apply-templates select="//ead:archdesc"/>
Expand Down Expand Up @@ -114,10 +117,14 @@
</xsl:template>

<xsl:template name="flat_container">
<xsl:variable name="query_url" select="php:function('islandora_manuscript_build_flat_query_url', ead:container)" />
<xsl:variable name="query_url">
<xsl:if test="$call_query_link = 'true'">
<xsl:value-of select="php:function('islandora_manuscript_build_flat_query_url', ead:container)" />
</xsl:if>
</xsl:variable>
<dd>
<xsl:choose>
<xsl:when test="$query_url">
<xsl:when test="normalize-space($query_url)">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$query_url"/>
Expand Down Expand Up @@ -146,10 +153,14 @@

<xsl:template match="ead:container" mode="parent">
<xsl:variable name="containers" select="//ead:container"/>
<xsl:variable name="query_url" select="php:function('islandora_manuscript_build_parented_query_url', current(), $containers)" />
<xsl:variable name="query_url">
<xsl:if test="$call_query_link = 'true'">
<xsl:value-of select="php:function('islandora_manuscript_build_parented_query_url', current(), $containers)" />
</xsl:if>
</xsl:variable>
<dd>
<xsl:choose>
<xsl:when test="$query_url">
<xsl:when test="normalize-space($query_url)">
<a>
<xsl:attribute name="href">
<xsl:copy-of select="$query_url"/>
Expand Down Expand Up @@ -190,13 +201,17 @@

<xsl:template name="ead_dao_xlink">
<xsl:for-each select="../ead:dao[@xlink:href]">
<xsl:variable name="direct_url" select="php:function('islandora_manuscript_build_direct_url', @xlink:href)" />
<xsl:variable name="direct_url">
<xsl:if test="$call_direct_link = 'true'">
<xsl:value-of select="php:function('islandora_manuscript_build_direct_url', @xlink:href)" />
</xsl:if>
</xsl:variable>
<li>
<xsl:choose>
<xsl:when test="$direct_url">
<xsl:when test="normalize-space($direct_url)">
<a>
<xsl:attribute name="href">
<xsl:value-of select="php:function('islandora_manuscript_build_direct_url', @xlink:href)" />
<xsl:value-of select="$direct_url" />
</xsl:attribute>
<xsl:value-of select="ead:daodesc" />
</a>
Expand Down

0 comments on commit af72881

Please sign in to comment.