Skip to content

Commit

Permalink
Merge pull request #78 from acdh-oeaw/data-lists-fix
Browse files Browse the repository at this point in the history
Data lists menu items, add metadata to explore samples output for new frontend
  • Loading branch information
simar0at authored Apr 25, 2024
2 parents 9eec3a9 + bb07235 commit f5cddaf
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 7 deletions.
9 changes: 7 additions & 2 deletions xslt/cross_lingfeatures_summary_01.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
<xsl:variable name="query">
<xsl:value-of select="concat('age=', encode-for-uri(./@age), '&amp;sex=', encode-for-uri(./@sex), '&amp;word=', ./@word, '&amp;translation=', ./@translation, '&amp;comment=', ./@comment)"/>
</xsl:variable>



<xsl:variable name="results" >
<xsl:for-each select="$features-shown">
Expand Down Expand Up @@ -114,8 +112,15 @@
</th>
<td>
<a href="#">
<!-- todo: remove old vicav style query when moved to Vicav-vue -->
<xsl:attribute name="data-type">feature</xsl:attribute>
<xsl:attribute name="data-query" select="concat($query,'&amp;location=region:', $region, $feature-query)"/>
<!-- new VICAV style dataset -->
<xsl:attribute name="data-target-type">ExploreSamples</xsl:attribute>
<xsl:attribute name="data-data-type">Feature</xsl:attribute>
<xsl:attribute name="data-region" select="$region"/>
<xsl:attribute name="data-features" select="$root/@features"/>
<xsl:attribute name="data-word" select="$root/@word"/>
<xsl:value-of select="$count"/>
<xsl:value-of select="' sentences'"/>
</a>
Expand Down
9 changes: 7 additions & 2 deletions xslt/cross_samples_01.xslt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml" xmlns:tei="http://www.tei-c.org/ns/1.0" version="2.0">
xmlns="http://www.w3.org/1999/xhtml" xmlns:tei="http://www.tei-c.org/ns/1.0"
version="3.1">
<xsl:include href="sampletexts_common.xslt"/>
<!-- VERSION 3.1.4 -->
<xsl:strip-space elements="*"/>
Expand Down Expand Up @@ -106,7 +107,11 @@
<small xml:space="preserve"><xsl:if test="./@informant != ''"> (<xsl:value-of select="./@informant"/><xsl:if test="./@sex != ''">/<xsl:value-of select="@sex"/></xsl:if><xsl:if test="@age != ''">/<xsl:value-of select="@age"/></xsl:if>)<xsl:if test=".//tei:revisionDesc/tei:change"><br/></xsl:if></xsl:if><xsl:value-of select="replace(.//tei:revisionDesc/tei:change[1]/@when, 'T.*', '')" /></small>
</td>
<td class="tdFeaturesRightTarget">
<a class="show-sentence" title="Show full sample text" href="#">
<a class="show-sentence" title="Show full sample text" href="#"
data-target-type="SampleText">
<xsl:attribute name="data-text-id">
<xsl:value-of select="./descendant::tei:TEI/@xml:id" />
</xsl:attribute>
<xsl:attribute name="data-sampletext">
<xsl:value-of select="./descendant::tei:TEI/@xml:id" />
</xsl:attribute>
Expand Down
5 changes: 5 additions & 0 deletions xslt/cross_samples_summary_01.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
<a href="#">
<xsl:attribute name="data-type">sample</xsl:attribute>
<xsl:attribute name="data-query" select="concat($query,'&amp;location=region:', $region, $feature-query)"/>
<xsl:attribute name="data-target-type">ExploreSamples</xsl:attribute>
<xsl:attribute name="data-data-type">SampleText</xsl:attribute>
<xsl:attribute name="data-region" select="$region"/>
<xsl:attribute name="data-features" select="$root/@features"/>
<xsl:attribute name="data-word" select="$root/@word"/>
<xsl:value-of select="$count"/>
<xsl:value-of select="' sentences'"/>
</a>
Expand Down
4 changes: 2 additions & 2 deletions xslt/menu-json.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</xsl:function>

<xsl:template match="/">
<json objects="json projectConfig logo frontpage menu params map center styleSettings colors staticData" arrays="panel param main item subnav scope geo table" numbers="zoom lat lng">
<json objects="json projectConfig logo frontpage menu params map center styleSettings colors staticData" arrays="panel param main item subnav scope geo table dataTypes" numbers="zoom lat lng">
<xsl:apply-templates/>
</json>
</xsl:template>
Expand Down Expand Up @@ -64,6 +64,7 @@
<type><xsl:value-of select="local-name()"/></type>
<targetType>
<xsl:choose>
<xsl:when test="@targetType"><xsl:value-of select="@targetType"/></xsl:when>
<xsl:when test="@type">
<xsl:choose>
<xsl:when test="data(@type) = 'vicavTexts'">Text</xsl:when>
Expand All @@ -77,7 +78,6 @@
<xsl:when test="starts-with(@xml:id, 'liSample')">SampleText</xsl:when>
<xsl:when test="data(@xml:id) = 'liBiblNewQuery'">BiblioEntries</xsl:when>
<xsl:when test="data(@xml:id) = 'liVicavCrossDictQuery'">CrossDictQuery</xsl:when>
<xsl:when test="@targetType"><xsl:value-of select="@targetType"/></xsl:when>
<xsl:otherwise>UnknownTypeWarning</xsl:otherwise>
</xsl:choose>
</targetType>
Expand Down
3 changes: 3 additions & 0 deletions xslt/profile_01.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
<xsl:when test="matches($geo, '^\s*\d+°')">
<xsl:value-of select="$geo"/>
</xsl:when>
<xsl:when test="matches($geo, '\d+\.\d+,\s*\d+\.\d+')">
<xsl:value-of select="$geo"/>
</xsl:when>
<xsl:otherwise>
<xsl:analyze-string select="$geo" regex="[\d\.]+">
<xsl:matching-substring>
Expand Down
18 changes: 17 additions & 1 deletion xslt/sampletexts_common.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ xmlns="http://www.w3.org/1999/xhtml"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:acdh="http://acdh.oeaw.ac.at"
exclude-result-prefixes="#all"
version="2.0">
version="3.1">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:param name="tei-link-marker" select="'false'" as="xs:string"/>
<xsl:include href="concat-path-inc.xslt"/>
Expand Down Expand Up @@ -228,6 +228,7 @@ version="2.0">
not(matches(following-sibling::tei:w[1]/tei:fs/tei:f[@name='wordform'], '^\W+$')) "/>
<xsl:sequence select="acdh:word-block(., 'sample', $add-space, '')"></xsl:sequence>
</xsl:template>


<xsl:function name="acdh:word-block">
<xsl:param name="w"></xsl:param>
Expand All @@ -240,12 +241,27 @@ version="2.0">
not(matches($w/following-sibling::tei:w[1]/tei:fs/tei:f[@name='wordform'], '^\W+$')) and
(not($w/ancestor::tei:choice) or $position != count($w/parent::*/*))"/>
<a class="word-search" href="#">
<!-- LEgacy VICAV format data-type and data-wordform -->
<xsl:attribute name="data-wordform">
<xsl:value-of select="$wordform" />
</xsl:attribute>
<xsl:attribute name="data-type">
<xsl:value-of select="$type" />
</xsl:attribute>
<!-- Vicav VUE format -->
<xsl:attribute name="data-word">
<xsl:value-of select="$wordform" />
</xsl:attribute>
<xsl:attribute name="data-target-type">ExploreSamples</xsl:attribute>
<xsl:attribute name="data-data-type">
<xsl:variable name="dataTypes" as="map(xs:string, xs:string)">
<xsl:map>
<xsl:map-entry key="'sample'" select="'SampleText'"/>
<xsl:map-entry key="'feature'" select="'Feature'"/>
</xsl:map>
</xsl:variable>
<xsl:value-of select="$dataTypes($type)" />
</xsl:attribute>
<xsl:sequence select="acdh:word-span($w, $highLightIdentifier)"></xsl:sequence>
</a>

Expand Down
7 changes: 7 additions & 0 deletions xslt/teiCorpusTeiHeader-json.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
</taxonomy>
</xsl:template>

<xsl:template match="t:settlement">
<settlement type="object">
<name type="array"><xsl:apply-templates select="t:name" mode="arrayItem"/></name>
</settlement>
</xsl:template>


<xsl:template match="t:listPrefixDef">
<listPrefixDef type="array">
<xsl:apply-templates select="t:prefixDef" mode="arrayItem"/>
Expand Down

0 comments on commit f5cddaf

Please sign in to comment.