lexonomy_editor_vsms/main.xslt

247 lines
13 KiB
HTML
Raw Normal View History

2019-03-06 22:32:02 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="clanek">
<div class="clanek">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="clanek/glava">
<div>
<xsl:apply-templates select="korpusi/korpus[1]/frek_lema | oblika/iztocnica | zaglavje/besedna_vrsta"/>
</div>
</xsl:template>
<xsl:template match="korpusi/korpus/frek_lema">
<xsl:text xml:space="preserve"> </xsl:text>
<span style="float: right;">
<xsl:choose>
<xsl:when test="number(.)&gt;22561"><span class="s1"></span><span class="s1"></span><span class="s1"></span><span class="s1"></span><span class="s1"></span></xsl:when>
<xsl:when test="number(.)&gt;8613"> <span class="s1"></span><span class="s1"></span><span class="s1"></span><span class="s1"></span><span class="s0"></span></xsl:when>
<xsl:when test="number(.)&gt;5206"> <span class="s1"></span><span class="s1"></span><span class="s1"></span><span class="s0"></span><span class="s0"></span></xsl:when>
<xsl:when test="number(.)&gt;552"> <span class="s1"></span><span class="s1"></span><span class="s0"></span><span class="s0"></span><span class="s0"></span></xsl:when>
<xsl:otherwise> <span class="s1"></span><span class="s0"></span><span class="s0"></span><span class="s0"></span><span class="s0"></span></xsl:otherwise>
</xsl:choose>
</span>
<xsl:text xml:space="preserve"> </xsl:text>
</xsl:template>
<xsl:template match="clanek/glava/oblika/iztocnica">
<xsl:text xml:space="preserve"> </xsl:text>
<span style="font-size: 1.2em; color: #cc3366; font-weight: bold;">
<xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template match="clanek/glava/zaglavje/besedna_vrsta">
<xsl:text xml:space="preserve"> </xsl:text>
<span style="color: #666666; font-style: italic;">
<xsl:apply-templates/>
</span>
<xsl:text xml:space="preserve"> </xsl:text>
</xsl:template>
<xsl:template match="clanek/geslo">
<div class="buttons" style="border-top: 1px dotted #999999; padding-top: 0.5em; margin-top: 0.5em;">
<label class="lblCollocations"><input type="checkbox"/> več kolokacij | több kollokáció</label>
<label class="lblExamples"><input type="checkbox"/> več zgledov | több példamondat</label>
<label class="lblPrevodi"><input type="checkbox"/> prevajaj zglede | bla bla bla</label>
</div>
<xsl:apply-templates/>
</xsl:template>
<!--a sense, or any other sense-level element-->
<xsl:template match="clanek/geslo/*">
<div style="border-top: 1px dotted #999999; padding-top: 0.5em; margin-top: 0.5em;">
<xsl:if test="name()='pomen'">
<div style="float: left; margin-left: 0.5em; color: #333333; font-weight: bold;">
<xsl:choose>
<xsl:when test="count(../pomen)&gt;1"><xsl:value-of select="position()"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
<div style="margin-left: 2em;">
<xsl:if test="ustaljena_oblika | indikator | oznaka | vecjez/prevod ">
<div><xsl:apply-templates select="ustaljena_oblika | indikator | oznaka | vecjez/prevod "/></div>
</xsl:if>
<div>
<xsl:apply-templates select="*[name()!='ustaljena_oblika' and name()!='indikator' and name()!='oznaka' and name()!='vecjez']"/>
</div>
</div>
</div>
</xsl:template>
<xsl:template match="clanek/geslo/*//s_oznaka"/>
<!--<xsl:template match="clanek/geslo/*//vir"/>-->
<xsl:template match="clanek/geslo/*//pomenska_shema"/>
<xsl:template match="clanek/geslo/*//definicija1"/>
<xsl:template match="clanek/geslo/*//definicija2"/>
<xsl:template match="s_oznaka"/>
<!--<xsl:template match="vir"/>-->
<xsl:template match="struktura"/>
<!--override headword at start of sense-->
<xsl:template match="ustaljena_oblika">
<xsl:text xml:space="preserve"> </xsl:text>
<span style="font-weight: bold;"><xsl:apply-templates/></span>
<xsl:text xml:space="preserve"> </xsl:text>
</xsl:template>
<!--disambiguators anywhere-->
<xsl:template match="indikator[text() or *]">
<xsl:if test="count(parent::pomen/../pomen)&gt;1 or oznaka">
<xsl:text xml:space="preserve"> </xsl:text>
<span>
<xsl:if test="not(oznaka) or text()"><xsl:text xml:space="preserve">(</xsl:text></xsl:if>
<xsl:apply-templates/>
<xsl:if test="not(oznaka) or text()"><xsl:text xml:space="preserve">)</xsl:text></xsl:if>
</span>
<xsl:text xml:space="preserve"> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="oznaka[text() or *]">
<xsl:if test="not(parent::indikator)"><xsl:text xml:space="preserve"> </xsl:text></xsl:if>
<span class="myed-oznaka">
<xsl:apply-templates/>
</span>
<xsl:if test="not(parent::indikator)"><xsl:text xml:space="preserve"> </xsl:text></xsl:if>
</xsl:template>
<xsl:template match="oznaka[text() or *]">
<span class="myed-oznaka">
<xsl:if test="not(parent::indikator/text())"><xsl:text xml:space="preserve">(</xsl:text></xsl:if>
<xsl:apply-templates/>
<xsl:if test="not(parent::indikator/text())"><xsl:text xml:space="preserve">)</xsl:text></xsl:if>
</span>
</xsl:template>
<xsl:template match="indikator | oznaka"/>
<!--sense-level translations-->
<xsl:template match="vecjez/prevod">
<xsl:if test="*">
<xsl:element name="div">
<xsl:attribute name="class">
myed-prevod-div
<xsl:if test="@cut='true'"> myed-prevod-cut</xsl:if>
<xsl:if test="@bin='true'"> myed-prevod-bin</xsl:if>
</xsl:attribute>
<xsl:attribute name="prevod_id"><xsl:value-of select="@prevod_id" /></xsl:attribute>
<xsl:attribute name="tabindex">1</xsl:attribute>
<span class="myed-prevod-oznaka"><xsl:apply-templates select=".//oznaka"/></span>
<span class="myed-prevod-text"><xsl:apply-templates select=".//tekst"/></span>
<sup><xsl:apply-templates select=".//vir"/></sup>
<span class="myed-prevod-razlaga"><xsl:apply-templates select=".//rzg"/></span>
<select class="myed-clanek-select">
<option value="edit" title="Spremeni / HUN"></option>
<option value="right" title="Premakni desno / HUN"></option>
<option value="left" title="Premakni levo / HUN" ></option>
<option value="semicolon" title="Podpicje / HUN">;</option>
<option value="cut" title="Osivi / HUN"></option>
<option value="bin" title="Odstrani trajno / HUN">🗑</option>
</select>
<xsl:element name="span">
<xsl:attribute name="class">
myed-prevod-semicolon
<xsl:if test="@semicolon!='true'">myed-prevod-semicolon-hidden</xsl:if>
</xsl:attribute>
;
</xsl:element>
</xsl:element>
</xsl:if>
<xsl:if test="position()=last()">
<xsl:element name="input">
<xsl:attribute name="class">myed-prevod-add</xsl:attribute>
<xsl:attribute name="tabindex">1</xsl:attribute>
<xsl:attribute name="line_num"><xsl:value-of select="@line_num"/></xsl:attribute>
<xsl:attribute name="type">button</xsl:attribute>
<xsl:attribute name="value">+</xsl:attribute>
<xsl:attribute name="title">Dodaj prevedek / HUN</xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:template>
<!--example-->
<xsl:template match="zgledi">
<xsl:apply-templates select=".//zgled"/>
</xsl:template>
<xsl:template match="zgled">
<xsl:element name="div">
<xsl:attribute name="style">margin: 0.26em 0 0.25em 0;</xsl:attribute>
<xsl:if test="not(parent::vecjez) or ancestor::vecjez/*[@hide='true'] or not(parent::vecjez/prevod/tekst/text())"><xsl:attribute name="class">hiddenExample</xsl:attribute></xsl:if>
<div style="float: left; margin-left: 0.5em; color: #666666; font-size: 0.65em; position: relative; top: -1px;">
</div>
<div style="margin-left: 1.5em;" class="zgled">
<div><xsl:apply-templates/></div>
<xsl:if test="@jezik='slo'">
<div class="myed-zgled-prevod">
<xsl:choose>
<xsl:when test="following-sibling::*[1][name()='prevod']">
<xsl:apply-templates select="following-sibling::*[1][name()='prevod']"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="input">
<xsl:attribute name="class">myed-zgled-prevod-btn</xsl:attribute>
<xsl:attribute name="zgled_id"><xsl:value-of select="@zgled_id" /></xsl:attribute>
<xsl:attribute name="type">button</xsl:attribute>
<xsl:attribute name="value">+</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
</div>
</xsl:element>
</xsl:template>
<xsl:template match="prevod[name(preceding-sibling::*[1])='zgled']">
<xsl:apply-templates/>
</xsl:template>
<!--phrasemes-->
<xsl:template match="*[kolokacija | r_kolokacija | enota | zveza]">
<xsl:apply-templates select="kolokacija | r_kolokacija | enota | zveza"/>
</xsl:template>
<xsl:template match="kolokacija | r_kolokacija | enota | zveza">
<xsl:element name="div">
<xsl:attribute name="style">margin: 0.25em 0 0.25em 0;</xsl:attribute>
<xsl:if test="@hide='true'"><xsl:attribute name="class">hiddenBlock</xsl:attribute></xsl:if>
<xsl:element name="span">
<xsl:attribute name="style">
<xsl:text>color: #cc3366;</xsl:text>
<xsl:if test="ancestor::stalne_zveze"><xsl:text>font-weight: bold;</xsl:text></xsl:if>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
<xsl:text xml:space="preserve"> </xsl:text>
<xsl:apply-templates select="following-sibling::indikator[1] | following-sibling::oznaka[1]"/>
<xsl:apply-templates select="parent::vecjez/prevod | parent::vecjez/pp"/>
<xsl:apply-templates select="parent::vecjez/zgledi"/>
<xsl:apply-templates select="zgledi"/>
</xsl:element>
</xsl:template>
<xsl:template match="kolokacija//* | r_kolokacija//*">
<xsl:text xml:space="preserve"> </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!--boxes-->
<xsl:template match="stalne_zveze">
<div style="margin: 0.5em 0 1em 0; padding: 1em 1em 0.25em 1em; background-color: #f6f6f6; border: 1px solid #dddddd; border-radius: 4px; text-shadow: 1px 1px 0px #ffffff;">
<div style="font-size: 0.9em; margin: -5px -5px 0.75px -5px; padding: 3px 10px; background-color: #eeeeee; border-radius: 2px;"><span>STALNE ZVEZE | ÁLLANDÓSULT SZÓKAPCSOLATOK</span></div>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="clanek/geslo/frazeoloske_enote | clanek/geslo/frazeoloske_zveze">
<div style="padding: 0.5em 0 0 0.5em; border-top: 1px dotted #999999; margin-top: 0.5em;">
<div style="font-size: 0.9em; margin: 0.5em 0 0.75em -0.5em; padding: 3px 10px; background-color: #eeeeee; border-radius: 2px;"><span>FRAZE | FRAZÉMÁK</span></div>
<xsl:apply-templates/>
</div>
</xsl:template>
</xsl:stylesheet>