Commit 2ee77bb6 authored by Michael Becker's avatar Michael Becker
Browse files

allow passive relations in mss74 (link to external works)

parent 0ee7d3c5
Pipeline #13642 passed with stage
in 2 minutes and 57 seconds
......@@ -4180,7 +4180,7 @@
<xed:output i18n="module.dptbase.common.editor.choose" />
</option>
<xed:include
uri="xslStyle:frbr-items2editor-options:classification:editor[Text]:-1:children:MyCoReFRBRerProperties"
uri="xslStyle:frbr-items2editor-options-all:classification:editor[Text]:-1:children:MyCoReFRBRerProperties"
cacheable="false" />
</select>
</xed:bind>
......@@ -4225,7 +4225,7 @@
<xed:output i18n="module.dptbase.common.editor.choose" />
</option>
<xed:include
uri="xslStyle:frbr-items2editor-options:classification:editor[Text]:-1:children:MyCoReFRBRerProperties"
uri="xslStyle:frbr-items2editor-options-all:classification:editor[Text]:-1:children:MyCoReFRBRerProperties"
cacheable="false" />
</select>
</xed:bind>
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xed="http://www.mycore.de/xeditor">
<!-- Transforms output of "classification:editorComplete:*" URIs to xeditor compatible format -->
<!-- same as frbr-items2editor-options but also allows selection of passive (has...) elements -->
<xsl:param name="CurrentLang" />
<xsl:param name="DefaultLang" />
<xsl:param name="MaxLengthVisible" />
<xsl:param name="Mode" />
<xsl:param name="allSelectable" select="'false'" />
<xsl:variable name="editor.list.indent" select="'&#160;&#160;&#160;'" />
<xsl:template match="items">
<xsl:choose>
<xsl:when test="$Mode='editor'">
<xsl:apply-templates select="." mode="editor" />
</xsl:when>
<xsl:otherwise>
<select>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</select>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="item">
<xsl:param name="indent" select="''" />
<xsl:variable name="toolTip">
<xsl:apply-templates select="." mode="toolTip" />
</xsl:variable>
<xsl:choose>
<xsl:when test="label[lang('x-group')] and not($allSelectable='true')">
<optgroup title="{$toolTip}">
<xsl:attribute name="label">
<xsl:value-of select="$indent" disable-output-escaping="yes" />
<xsl:apply-templates select="." mode="label" />
</xsl:attribute>
<xsl:copy-of select="@*" />
<xsl:apply-templates select="item">
<xsl:with-param name="indent" select="concat($editor.list.indent,$indent)" />
</xsl:apply-templates>
</optgroup>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@value" />
<xsl:if test="
@value = 'isContinuation' or @value = 'isEditing' or @value = 'isExemplarOf' or
@value = 'isGloss' or @value = 'isPartOf' or @value = 'isTranslationOf' or
@value = 'isCommentary' or
@value = 'hasContinuation' or @value = 'hasEditing' or @value = 'hasExemplar' or
@value = 'hasGloss' or @value = 'hasPart' or @value = 'hasTranslation' or
@value = 'hasCommentary'">
<option title="{$toolTip}">
<xsl:if test="label[lang('x-disable')] and not($allSelectable='true')">
<xsl:attribute name="disabled" />
</xsl:if>
<xsl:attribute name="value">
<xsl:value-of select="@value" />
</xsl:attribute>
<xsl:attribute name="title">
<xsl:apply-templates select="." mode="label" />
</xsl:attribute>
<xsl:value-of select="$indent" disable-output-escaping="yes" />
<xsl:apply-templates select="." mode="label" />
</option>
</xsl:if>
<xsl:apply-templates select="item">
<xsl:with-param name="indent" select="concat($editor.list.indent,$indent)" />
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="item" mode="label">
<xsl:variable name="onDisplay">
<xsl:choose>
<xsl:when test="label[lang($CurrentLang)]">
<xsl:value-of select="label[lang($CurrentLang)]" />
</xsl:when>
<xsl:when test="label[lang($DefaultLang)]">
<xsl:value-of select="label[lang($DefaultLang)]" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="shorten">
<xsl:with-param name="onDisplay" select="$onDisplay" />
</xsl:call-template>
</xsl:template>
<xsl:template match="item" mode="toolTip">
<xsl:choose>
<xsl:when test="label[lang($CurrentLang)]">
<xsl:value-of select="label[lang($CurrentLang)]" />
</xsl:when>
<xsl:when test="label[lang($DefaultLang)]">
<xsl:value-of select="label[lang($DefaultLang)]" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="items" mode="editor">
<items>
<xsl:apply-templates mode="editor" />
</items>
</xsl:template>
<xsl:template match="item" mode="editor">
<item value="{@value}">
<xsl:for-each select="label">
<xsl:apply-templates select="." mode="editor" />
</xsl:for-each>
<!-- ==== handle children ==== -->
<xsl:apply-templates select="item" mode="editor" />
</item>
</xsl:template>
<xsl:template match="label" mode="editor">
<label xml:lang="{@xml:lang}">
<xsl:call-template name="shorten">
<xsl:with-param name="onDisplay" select="." />
</xsl:call-template>
</label>
</xsl:template>
<xsl:template name="shorten">
<xsl:param name="onDisplay" />
<xsl:choose>
<xsl:when test="$MaxLengthVisible and (string-length($onDisplay) &gt; $MaxLengthVisible) ">
<xsl:value-of select="concat(substring($onDisplay, 0, $MaxLengthVisible), ' [...]')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$onDisplay" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment