Mode:

Compact lists

Showing:

Documentation
Parameters
Used by
References
Overriding
Imported from
Source
Stylesheet figures.xsl
Documentation

Description

TEI stylesheet dealing with elements from the figures module, making LaTeX output.

This software is dual-licensed: 1. Distributed under a Creative Commons Attribution-ShareAlike 3.0 Unported License http://creativecommons.org/licenses/by-sa/3.0/ 2. http://www.opensource.org/licenses/BSD-2-Clause All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Author: See AUTHORS

Id: $Id: figures.xsl 9646 2011-11-05 23:39:08Z rahtz $

Copyright: 2011, TEI Consortium

Imported from
Stylesheet version 2.0
Template tei:cell
Documentation

Description

Process element cell
Namespace No namespace
Match tei:cell
Mode #default
Import precedence 3
Source
<xsl:template match="tei:cell">
  <xsl:if test="preceding-sibling::tei:cell">\tabcellsep</xsl:if>
  <xsl:choose>
    <xsl:when test="@role='label'">
      <xsl:text>\Panel{</xsl:text>
      <xsl:if test="starts-with(normalize-space(.),'[')">
        <xsl:text>{}</xsl:text>
      </xsl:if>
      <xsl:apply-templates/>
      <xsl:text>}{label}{</xsl:text>
      <xsl:choose>
        <xsl:when test="@cols">
          <xsl:value-of select="@cols"/>
        </xsl:when>
        <xsl:otherwise>1</xsl:otherwise>
      </xsl:choose>
      <xsl:text>}{</xsl:text>
      <xsl:choose>
        <xsl:when test="@align='right'">r</xsl:when>
        <xsl:when test="@align='centre'">c</xsl:when>
        <xsl:when test="@align='center'">c</xsl:when>
        <xsl:when test="@align='left'">l</xsl:when>
        <xsl:otherwise>l</xsl:otherwise>
      </xsl:choose>
      <xsl:text>}</xsl:text>
    </xsl:when>
    <xsl:when test="@cols > 1">
      <xsl:text>\multicolumn{</xsl:text>
      <xsl:value-of select="@cols"/>
      <xsl:text>}{</xsl:text>
      <xsl:if test="@role='label' or      parent::tei:row/@role='label'">
        <xsl:text>){\columncolor{label}}</xsl:text>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="@align='right'">r</xsl:when>
        <xsl:when test="@align='centre'">c</xsl:when>
        <xsl:when test="@align='center'">c</xsl:when>
        <xsl:when test="@align='left'">l</xsl:when>
        <xsl:otherwise>l</xsl:otherwise>
      </xsl:choose>
      <xsl:text>}{</xsl:text>
      <xsl:apply-templates/>
      <xsl:text>}</xsl:text>
    </xsl:when>
    <xsl:when test="@align">
      <xsl:text>\multicolumn{1}{</xsl:text>
      <xsl:if test="@role='label' or      parent::tei:row/@role='label'">
        <xsl:text>){\columncolor{label}}</xsl:text>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="@align='right'">r</xsl:when>
        <xsl:when test="@align='centre'">c</xsl:when>
        <xsl:when test="@align='center'">c</xsl:when>
        <xsl:when test="@align='left'">l</xsl:when>
        <xsl:otherwise>l</xsl:otherwise>
      </xsl:choose>
      <xsl:text>}{</xsl:text>
      <xsl:apply-templates/>
      <xsl:text>}</xsl:text>
    </xsl:when>
    <xsl:otherwise>
      <xsl:if test="starts-with(normalize-space(.),'[')">
        <xsl:text>{}</xsl:text>
      </xsl:if>
      <xsl:apply-templates/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location figures.xsl
Template tei:figDesc
Documentation

Description

Process element figDesc
Namespace No namespace
Match tei:figDesc
Mode #default
Import precedence 3
Source
<xsl:template match="tei:figDesc"/>
Stylesheet location figures.xsl
Template tei:figure
Documentation

Description

Process element figure
Namespace No namespace
Match tei:figure
Mode #default
References
Import precedence 3
Source
<xsl:template match="tei:figure">
  <xsl:call-template name="makeFigureStart"/>
  <xsl:apply-templates/>
  <xsl:call-template name="makeFigureEnd"/>
</xsl:template>
Stylesheet location figures.xsl
Template tei:graphic
Documentation

Description

Process element graphic
Namespace No namespace
Match tei:graphic
Mode #default
References
Template
Import precedence 3
Source
<xsl:template match="tei:graphic">
  <xsl:call-template name="makePic"/>
</xsl:template>
Stylesheet location figures.xsl
Template tei:row
Documentation

Description

Process element row
Namespace No namespace
Match tei:row
Mode #default
Import precedence 3
Source
<xsl:template match="tei:row">
  <xsl:if test="@role='label'">\rowcolor{label}</xsl:if>
  <xsl:apply-templates/>
  <xsl:if test="following-sibling::tei:row">
    <xsl:text>\\</xsl:text>
    <xsl:if test="@role='label' or parent::tei:table/@rend='rules'">\hline</xsl:if>
    <xsl:text>
</xsl:text>
  </xsl:if>
</xsl:template>
Stylesheet location figures.xsl
Template tei:tablexref
Documentation

Description

Process element table
Namespace No namespace
Match tei:table
Mode xref
Overriding
Template
Import precedence 3
Source
<xsl:template match="tei:table" mode="xref">
  <xsl:text>the table on p. \pageref{</xsl:text>
  <xsl:value-of select="@xml:id"/>
  <xsl:text>}</xsl:text>
</xsl:template>
Stylesheet location figures.xsl
Template tei:table
Documentation

Description

Process element table
Namespace No namespace
Match tei:table
Mode #default
References
Template
Import precedence 3
Source
<xsl:template match="tei:table">
  <xsl:if test="@xml:id">
    <xsl:text>\label{</xsl:text>
    <xsl:value-of select="@xml:id"/>
    <xsl:text>}</xsl:text>
  </xsl:if>
  <xsl:text> \par </xsl:text>
  <xsl:choose>
    <xsl:when test="ancestor::tei:table">
      <xsl:text>\begin{tabular}</xsl:text>
      <xsl:call-template name="makeTable"/>
      <xsl:text>\end{tabular}</xsl:text>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text>
\begin{longtable}</xsl:text>
      <xsl:call-template name="makeTable"/>
      <xsl:text>\end{longtable} \par
 </xsl:text>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location figures.xsl
Template tei:table[@rend='display']xref
Documentation

Description

Process element table[@rend='display']
Namespace No namespace
Match tei:table[@rend='display']
Mode xref
Import precedence 3
Source
<xsl:template match="tei:table[@rend='display']" mode="xref">
  <xsl:text>Table </xsl:text>
  <xsl:number count="tei:table[@rend='display']" level="any"/>
</xsl:template>
Stylesheet location figures.xsl
Template tei:table[@rend='display']
Documentation

Description

Process element table[@rend='display']
Namespace No namespace
Match tei:table[@rend='display']
Mode #default
References
Template
Import precedence 3
Source
<xsl:template match="tei:table[@rend='display']">
  <xsl:text>\begin{table}</xsl:text>
  <xsl:text>\begin{center} \begin{small} \begin{tabular}</xsl:text>
  <xsl:call-template name="makeTable"/>
  <xsl:text>\end{tabular} 
      \caption{</xsl:text>
  <xsl:if test="@xml:id">\label{
    <xsl:value-of select="@xml:id"/>}</xsl:if>
  <xsl:apply-templates mode="ok" select="tei:head"/>
  <xsl:text>}
     \end{small} 
     \end{center}
     \end{table}</xsl:text>
</xsl:template>
Stylesheet location figures.xsl
Template makeFigureStart
Documentation

Description

[latex] Make figure (start)
Namespace No namespace
Used by
Template
Import precedence 3
Source
<xsl:template name="makeFigureStart">
  <xsl:choose>
    <xsl:when test="@place='inline' and tei:head">
      <xsl:text>\begin{figure}[H]
</xsl:text>
    </xsl:when>
    <xsl:when test="@rend='display' or not(@place='inline') or tei:head or tei:p">
      <xsl:text>\begin{figure}[htbp]
</xsl:text>
    </xsl:when>
  </xsl:choose>
  <xsl:choose>
    <xsl:when test="@rend='center'">
      <xsl:text>\begin{center}</xsl:text>
    </xsl:when>
    <xsl:otherwise>\noindent</xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location figures.xsl
Template makeFigureEnd
Documentation

Description

[latex] Make figure (end)
Namespace No namespace
Used by
Template
Import precedence 3
Source
<xsl:template name="makeFigureEnd">
  <xsl:choose>
    <xsl:when test="tei:head or tei:p">
      <xsl:text>
\caption{</xsl:text>
      <xsl:if test="@xml:id">\label{
        <xsl:value-of select="@xml:id"/>}</xsl:if>
      <xsl:for-each select="tei:head">
        <xsl:apply-templates/>
      </xsl:for-each>
      <xsl:text>}</xsl:text>
    </xsl:when>
  </xsl:choose>
  <xsl:if test="@rend='center'">
    <xsl:text>\end{center}</xsl:text>
  </xsl:if>
  <xsl:choose>
    <xsl:when test="@place='inline' and tei:head">
      <xsl:text>\end{figure}
</xsl:text>
    </xsl:when>
    <xsl:when test="@rend='display' or not(@place='inline')">
      <xsl:text>\end{figure}
</xsl:text>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Stylesheet location figures.xsl
Template makePic
Documentation

Description

[latex] Make picture
Namespace No namespace
Used by
Template
References
Template
Parameter
Import precedence 3
Source
<xsl:template name="makePic">
  <xsl:if test="@xml:id">\hypertarget{
    <xsl:value-of select="@xml:id"/>}{}</xsl:if>
  <xsl:choose>
    <xsl:when test="@rend='noindent'">
      <xsl:text>\noindent</xsl:text>
    </xsl:when>
    <xsl:when test="not(preceding-sibling::*)">
      <xsl:text>\noindent</xsl:text>
    </xsl:when>
  </xsl:choose>
  <xsl:text>\includegraphics[</xsl:text>
  <xsl:call-template name="graphicsAttributes">
    <xsl:with-param name="mode">latex</xsl:with-param>
  </xsl:call-template>
  <xsl:text>]{</xsl:text>
  <xsl:choose>
    <xsl:when test="$realFigures='true'">
      <xsl:choose>
        <xsl:when test="@url">
          <xsl:value-of select="@url"/>
        </xsl:when>
        <xsl:when test="@entity">
          <xsl:value-of select="unparsed-entity-uri(@entity)"/>
        </xsl:when>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="c">
        <xsl:for-each select="ancestor-or-self::tei:figure[1]">
          <xsl:number level="any"/>
        </xsl:for-each>
      </xsl:variable>
      <xsl:text>FIG</xsl:text>
      <xsl:value-of select="$c+1000"/>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:text>}</xsl:text>
</xsl:template>
Stylesheet location figures.xsl
Template makeTable
Documentation

Description

[latex]
Namespace No namespace
Used by
References
Import precedence 3
Source
<xsl:template name="makeTable">
  <xsl:variable name="r">
    <xsl:value-of select="@rend"/>
  </xsl:variable>
  <xsl:text>{</xsl:text>
  <xsl:if test="contains($r,'rules')">|</xsl:if>
  <xsl:choose>
    <xsl:when test="@preamble">
      <xsl:value-of select="@preamble"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="makePreamble-complex">
        <xsl:with-param name="r" select="$r"/>
      </xsl:call-template>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:text>}
</xsl:text>
  <xsl:if test="contains($r,'rules') or tei:head">
    <xsl:call-template name="tableHline"/>
  </xsl:if>
  <xsl:choose>
    <xsl:when test="tei:head and not(@rend='display')">
      <xsl:if test="not(ancestor::tei:table)">
        <xsl:text>\endfirsthead </xsl:text>
        <xsl:text>\multicolumn{</xsl:text>
        <xsl:value-of select="count(tei:row[1]/tei:cell)"/>
        <xsl:text>}{c}{</xsl:text>
        <xsl:apply-templates mode="ok" select="tei:head"/>
        <xsl:text>(cont.)}\\\hline \endhead </xsl:text>
      </xsl:if>
      <xsl:text>\caption{</xsl:text>
      <xsl:apply-templates mode="ok" select="tei:head"/>
      <xsl:text>}\\ </xsl:text>
    </xsl:when>
    <xsl:otherwise>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="contains($r,'rules') or tei:row[1][@role='label']">\hline</xsl:if>
  <xsl:apply-templates/>
  <xsl:if test="contains($r,'rules')">
    <xsl:text>\\ \hline </xsl:text>
  </xsl:if>
</xsl:template>
Stylesheet location figures.xsl
Template tableHline
Namespace No namespace
Used by
Template
Import precedence 3
Source
<xsl:template name="tableHline">
  <xsl:choose>
    <xsl:when test="ancestor::tei:table or @rend='display'">\hline</xsl:when>
    <xsl:otherwise>\hline\endfoot\hline\endlastfoot</xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location figures.xsl
Template makePreamble-complex
Documentation

Description

[latex]
Namespace No namespace
Used by
Template
References
Parameter
Parameters
QName Namespace
r No namespace
Import precedence 3
Source
<xsl:template name="makePreamble-complex">
  <xsl:param name="r"/>
  <xsl:variable name="valign">
    <xsl:choose>
      <xsl:when test="contains($r,'bottomAlign')">B</xsl:when>
      <xsl:when test="contains($r,'midAlign')">M</xsl:when>
      <xsl:otherwise>P</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="tds">
    <xsl:for-each select="tei:row">
      <xsl:variable name="row">
        <xsl:for-each select="tei:cell">
          <xsl:variable name="stuff">
            <xsl:apply-templates/>
          </xsl:variable>
          <cell>
            <xsl:value-of select="string-length($stuff)"/>
          </cell>
          <xsl:if test="@cols">
            <xsl:variable name="c" select="xs:integer(@cols) - 1 "/>
            <xsl:for-each select="1 to $c">
              <cell>0</cell>
            </xsl:for-each>
          </xsl:if>
        </xsl:for-each>
      </xsl:variable>
      <xsl:for-each select="$row/cell">
        <cell col="{position()}">
          <xsl:value-of select="."/>
        </cell>
      </xsl:for-each>
    </xsl:for-each>
  </xsl:variable>
  <xsl:variable name="total">
    <xsl:value-of select="sum($tds/cell)"/>
  </xsl:variable>
  <xsl:for-each select="$tds/cell">
    <xsl:variable name="c" select="@col"/>
    <xsl:if test="not(preceding-sibling::cell[$c=@col])">
      <xsl:variable name="len">
        <xsl:value-of select="sum(following-sibling::cell[$c=@col]) + current()"/>
      </xsl:variable>
      <xsl:value-of select="$valign"/>
      <xsl:text>{</xsl:text>
      <xsl:value-of select="($len div $total) * $tableMaxWidth"/>
      <xsl:text>\textwidth}</xsl:text>
      <xsl:if test="contains($r,'rules')">|</xsl:if>
    </xsl:if>
  </xsl:for-each>
</xsl:template>
Stylesheet location figures.xsl
Template makePreamble-simple
Documentation

Description

[latex]
Namespace No namespace
Parameters
QName Namespace
r No namespace
Import precedence 3
Source
<xsl:template name="makePreamble-simple">
  <xsl:param name="r"/>
  <xsl:for-each select="tei:row[1]/tei:cell">
    <xsl:text>l</xsl:text>
    <xsl:if test="contains($r,'rules')">|</xsl:if>
  </xsl:for-each>
</xsl:template>
Stylesheet location figures.xsl