Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 36 additions & 12 deletions packtools/catalogs/htmlgenerator/v2.0/article-text-back.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,45 @@
</xsl:template>

<xsl:template match="*" mode="back-section">
<div>
<xsl:if test="label or title">
<xsl:attribute name="class">articleSection</xsl:attribute>
<xsl:attribute name="data-anchor"><xsl:apply-templates select="." mode="title"></xsl:apply-templates></xsl:attribute>
</xsl:if>
<h1>
<xsl:if test="label or title">
<xsl:attribute name="class">articleSectionTitle</xsl:attribute>
<xsl:apply-templates select="." mode="title"></xsl:apply-templates>
</xsl:if>
</h1>
<xsl:apply-templates select="." mode="back-section-content"></xsl:apply-templates>
<div class="articleSection">
<xsl:apply-templates select="." mode="back-section-menu"/>
<xsl:apply-templates select="." mode="back-section-h"/>
<xsl:apply-templates select="." mode="back-section-content"/>
</div>
</xsl:template>

<xsl:template match="*" mode="back-section-menu">
<xsl:if test="title or label">
<xsl:attribute name="data-anchor">
<xsl:apply-templates select="label"/>
<xsl:if test="label and title">&#160;</xsl:if>
<xsl:apply-templates select="title"/>
</xsl:attribute>
</xsl:if>
</xsl:template>

<xsl:template match="ref-list" mode="back-section-menu">
<xsl:variable name="name" select="name()"/>
<!-- cria menu somente para o primeiro ref-list (há casos de série de ref-list) -->
<xsl:if test="not(preceding-sibling::node()) or preceding-sibling::*[1][name()!=$name]">
<xsl:attribute name="data-anchor">
<xsl:apply-templates select="." mode="text-labels">
<xsl:with-param name="text">ref-list</xsl:with-param>
</xsl:apply-templates>
</xsl:attribute>
</xsl:if>
</xsl:template>

<xsl:template match="*" mode="back-section-h">
<xsl:if test="title or label">
<h1 class="articleSectionTitle">
<xsl:apply-templates select="label"/>
<xsl:if test="label and title">&#160;</xsl:if>
<xsl:apply-templates select="title"/>
</h1>
</xsl:if>
</xsl:template>

<xsl:template match="app-group" mode="back-section">
<xsl:apply-templates select="app" mode="back-section"></xsl:apply-templates>
</xsl:template>
Expand Down
157 changes: 104 additions & 53 deletions packtools/catalogs/htmlgenerator/v2.0/article-text-fn.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,84 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="article" mode="text-fn">
<xsl:template match="article" mode="text-fn">
<!--
Apresenta uma lista de fn encontrados em body, exceto os de table-wrap
-->
<xsl:choose>
<xsl:when test=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']//body">
<xsl:apply-templates select=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']//body" mode="text-fn"/>
<xsl:when test=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']//body//fn">
<xsl:apply-templates select=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']/body" mode="text-fn"/>
</xsl:when>
<xsl:when test="body">
<xsl:when test="body//fn">
<xsl:apply-templates select="body" mode="text-fn"/>
</xsl:when>
</xsl:choose>
</xsl:template>

<xsl:template match="body" mode="text-fn">
<xsl:variable name="footnotes"><xsl:apply-templates select=".//fn" mode="text-fn"/></xsl:variable>
<xsl:if test="normalize-space($footnotes) != ''">
<div class="articleSection">
<h2></h2>
<div class="ref-list">
<xsl:value-of select="$footnotes"/>
</div>
</div>
<!--
Apresenta uma lista de fn encontrados em body, exceto os de table-wrap
-->
<xsl:if test="count(.//fn) &gt; count(.//table-wrap-foot//fn)">
<!-- fn em body -->
<xsl:apply-templates select=".//fn" mode="text-fn"/>
</xsl:if>
</xsl:template>

<xsl:template match="fn" mode="text-fn">
<xsl:apply-templates select="."/>
<!--
Apresenta uma lista de fn encontrados em body, exceto os de table-wrap
-->
<xsl:apply-templates select="." mode="choose-format"/>
</xsl:template>

<xsl:template match="table-wrap-foot//fn" mode="text-fn">
<!-- do nothing for table-wrap-foot/fn -->
</xsl:template>

<xsl:template match="fn">
<li>
<xsl:template match="fn" mode="choose-format">
<!--
Dependendo do tipo de fn, apresenta em formato de
back-section ou item de lista
-->
<xsl:choose>
<xsl:when test="@fn-type='edited-by' or @fn-type='data-availability'">
<xsl:apply-templates select="." mode="back-section"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="div-fn-list-item"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="fn/p">
<div>
<xsl:apply-templates select="*|text()"/>
</li>
</div>
</xsl:template>

<xsl:template match="body//fn">
<!-- do nothing for fn in body -->
</xsl:template>

<xsl:template match="table-wrap-foot//fn">
<!-- display table-wrap-foot/fn -->
<xsl:apply-templates select="." mode="div-fn-list-item"/>
</xsl:template>

<xsl:template match="fn[@fn-type='edited-by'] | fn[@fn-type='data-availability']">
<xsl:template match="fn" mode="div-fn-list-item">
<li>
<xsl:apply-templates select="." mode="open-science-notes"/>
<xsl:apply-templates select="*|text()" mode="div-fn-list-item"/>
</li>
</xsl:template>

<xsl:template match="fn/label">
<xsl:template match="fn/p | fn/*" mode="div-fn-list-item">
<div>
<xsl:apply-templates select="*|text()"/>
</div>
</xsl:template>

<xsl:template match="fn/label" mode="div-fn-list-item">
<xsl:variable name="title"><xsl:apply-templates select="*|text()"/></xsl:variable>
<xsl:choose>
<xsl:when test="string-length(normalize-space($title)) &gt; 3">
Expand All @@ -56,52 +91,68 @@
</xsl:choose>
</xsl:template>

<xsl:template match="fn/p">
<div>
<xsl:apply-templates select="*|text()"></xsl:apply-templates>
</div>
</xsl:template>

<xsl:template match="fn/title">
<h2><xsl:apply-templates select="*|text()"></xsl:apply-templates></h2>
<xsl:template match="fn/title" mode="div-fn-list-item">
<h2><xsl:apply-templates select="*|text()"/></h2>
</xsl:template>

<xsl:template match="back/fn | back/fn-group" mode="back-section-content">
<div class="ref-list">
<ul class="refList footnote">
<xsl:apply-templates select="*[name()!='title']|text()"></xsl:apply-templates>
</ul>
</div>
<xsl:template match="fn[@fn-type='edited-by']/label | fn[@fn-type='data-availability']/label | fn[@fn-type='edited-by']/title | fn[@fn-type='data-availability']/title" mode="div-fn-list-item">
<!-- do nothing for fn edited-by or data-availability -->
</xsl:template>

<xsl:template match="body//fn | back/fn | author-notes/fn | back/fn-group" mode="back-section-content">
<div class="ref-list">
<ul class="refList footnote">
<xsl:apply-templates select="fn" mode="div-fn-list-item"/>
<xsl:if test="not(fn)">
<xsl:apply-templates select="." mode="div-fn-list-item"/>
</xsl:if>
</ul>
</div>
</xsl:template>

<xsl:template match="article" mode="author-notes-as-sections">
<xsl:choose>
<xsl:when test=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']">
<xsl:apply-templates select=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']//front-stub//author-notes" mode="author-notes-as-sections"/>
<xsl:when test=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']//author-notes">
<xsl:apply-templates select=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']//front-stub//author-notes/fn" mode="author-notes-as-sections"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select=".//front//author-notes" mode="author-notes-as-sections"/>
<xsl:apply-templates select=".//front//author-notes/fn" mode="author-notes-as-sections"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="author-notes" mode="author-notes-as-sections">
<!--
destaca algumas notas de autores, colocando-as no menu esquerdo
-->
<xsl:apply-templates select="fn[@fn-type='edited-by'] | fn[@fn-type='data-availability']" mode="open-science-notes"/>
<xsl:template match="author-notes/fn" mode="author-notes-as-sections">
<!-- do nothing for fn <xsl:value-of select="@fn-type"/> -->
</xsl:template>

<xsl:template match="fn[@fn-type='edited-by'] | fn[@fn-type='data-availability']" mode="open-science-notes">
<xsl:variable name="title"><xsl:apply-templates select="label"/><xsl:if test="not(label)"><xsl:apply-templates select="." mode="text-labels">
<xsl:with-param name="text"><xsl:value-of select="@fn-type"/></xsl:with-param>
</xsl:apply-templates></xsl:if></xsl:variable>
<div>
<xsl:attribute name="class">articleSection</xsl:attribute>
<xsl:attribute name="data-anchor"><xsl:value-of select="translate($title, ':', '')"/></xsl:attribute>
<h3><xsl:value-of select="translate($title, ':', '')"/></h3>
<xsl:apply-templates select="*[name()!='label']|text()"/>
</div>
<xsl:template match="author-notes/fn[@id]" mode="author-notes-as-sections">
<xsl:variable name="id" select="@id"/>
<xsl:if test="$article//xref[@rid=$id]">
<xsl:apply-templates select="." mode="back-section"/>
</xsl:if>
</xsl:template>

<xsl:template match="fn[@fn-type='edited-by'] | fn[ @fn-type='data-availability']" mode="author-notes-as-sections">
<xsl:apply-templates select="." mode="back-section"/>
</xsl:template>

<xsl:template match="fn[@fn-type='edited-by'] | fn[ @fn-type='data-availability']" mode="back-section-menu">
<xsl:variable name="name" select="@fn-type"/>
<!-- cria menu somente para o primeiro ref-list (há casos de série de ref-list) -->
<xsl:if test="not(preceding-sibling::node()) or preceding-sibling::*[1][not(@fn-type)] or preceding-sibling::*[1][@fn-type!=$name]">
<xsl:attribute name="data-anchor">
<xsl:apply-templates select="." mode="text-labels">
<xsl:with-param name="text"><xsl:value-of select="@fn-type"/></xsl:with-param>
</xsl:apply-templates>
</xsl:attribute>
<xsl:if test="not(title) and not(label)">
<h3>
<xsl:apply-templates select="." mode="text-labels">
<xsl:with-param name="text"><xsl:value-of select="@fn-type"/></xsl:with-param>
</xsl:apply-templates>
</h3>
</xsl:if>
</xsl:if>
</xsl:template>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@

<xsl:template match="article" mode="data-availability">
<xsl:if test=".//article-meta/supplementary-material or .//element-citation[@publication-type='data' or @publication-type='database']">
<xsl:variable name="title">
<xsl:apply-templates select="." mode="text-labels">
<xsl:with-param name="text">Data availability</xsl:with-param>
</xsl:apply-templates>
</xsl:variable>
<div class="articleSection">
<xsl:attribute name="data-anchor"><xsl:value-of select="$title"/></xsl:attribute>
<h1 class="articleSectionTitle"><xsl:value-of select="$title"/></h1>
</div>
<xsl:apply-templates select="." mode="data-availability-menu-title"/>
<xsl:choose>
<xsl:when test=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']">
<!-- sub-article -->
Expand All @@ -27,7 +19,18 @@
<xsl:apply-templates select=".//ref-list" mode="data-availability"/>

</xsl:if>
</xsl:template>

<xsl:template match="article" mode="data-availability-menu-title">
<xsl:variable name="title">
<xsl:apply-templates select="." mode="text-labels">
<xsl:with-param name="text">Data availability</xsl:with-param>
</xsl:apply-templates>
</xsl:variable>
<div class="articleSection">
<xsl:attribute name="data-anchor"><xsl:value-of select="$title"/></xsl:attribute>
<h1 class="articleSectionTitle"><xsl:value-of select="$title"/></h1>
</div>
</xsl:template>

<xsl:template match="ref-list" mode="data-availability">
Expand Down
10 changes: 6 additions & 4 deletions packtools/catalogs/htmlgenerator/v2.0/article-text.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<xsl:template match="*" mode="text-body">

<xsl:variable name="alttile">
<xsl:variable name="alt_title">
<xsl:choose>
<xsl:when test=".//sub-article[@article-type!='translation'] or .//response">
<xsl:apply-templates select="." mode="text-labels">
Expand All @@ -18,18 +18,20 @@
<xsl:choose>
<xsl:when test=".//sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']">
<xsl:apply-templates select="sub-article[@xml:lang=$TEXT_LANG and @article-type='translation']" mode="body">
<xsl:with-param name="alt_title" select="$alttile"></xsl:with-param>
<xsl:with-param name="alt_title" select="$alt_title"></xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="./body">
<xsl:with-param name="alt_title" select="$alttile"></xsl:with-param></xsl:apply-templates>
<xsl:with-param name="alt_title" select="$alt_title"></xsl:with-param></xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="sub-article" mode="body">
<xsl:apply-templates select="body"/>
<xsl:param name="alt_title"></xsl:param>
<xsl:apply-templates select="./body">
<xsl:with-param name="alt_title" select="$alt_title"></xsl:with-param></xsl:apply-templates>
</xsl:template>

<xsl:template match="body">
Expand Down
8 changes: 4 additions & 4 deletions packtools/catalogs/htmlgenerator/v2.0/config-labels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</term>
<term>
<name>Data availability</name>
<name lang="pt">Dados de pesquisa</name>
<name lang="es">Datos de investigación</name>
<name lang="pt">Disponibilidade de dados</name>
<name lang="es">Disponibilidad de datos</name>
</term>
<term>
<name>Data citations</name>
Expand Down Expand Up @@ -429,8 +429,8 @@
<term>
<name>edited-by</name>
<name lang="en">Edited by</name>
<name lang="pt">Editado por</name>
<name lang="es">Editado por</name>
<name lang="pt">Editores</name>
<name lang="es">Editores</name>
</term>

<term>
Expand Down
Loading