Showing:

Documentation
Parameters
References
Included from
Source
Stylesheet wordsections.xsl
Documentation

Description

TEI stylesheet for making Word docx files from TEI XML

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Author: See AUTHORS

Id: $Id: wordsections.xsl 7952 2010-08-12 21:14:51Z rahtz $

Copyright: 2008, TEI Consortium

Included from
Stylesheet version 2.0
Template tei:milestone
Documentation

Description

Dealing with sections

Description

 Templates transforming tei milestones into sectPr 
Namespace No namespace
Match tei:milestone
Mode #default
References
Parameters
QName Namespace
final-section No namespace
Import precedence 12
Source
<xsl:template match="tei:milestone">
  <xsl:param name="final-section">false</xsl:param>
  <!-- construct sectPr -->
  <xsl:variable name="sectPr">
    <w:sectPr>
      <xsl:for-each select="teidocx:footer">
        <xsl:variable name="ref" select="@ref"/>
        <xsl:if test="count(key('FOOTERS',$ref))>0">
          <xsl:variable name="footernum">
            <xsl:for-each select="key('FOOTERS',$ref)">
              <xsl:number level="any"/>
            </xsl:for-each>
          </xsl:variable>
          <w:footerReference w:type="{@type}" r:id="{concat('rId',100+$footernum)}"/>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="teidocx:header">
        <xsl:variable name="ref" select="@ref"/>
        <xsl:if test="count(key('HEADERS',$ref))>0">
          <xsl:variable name="headernum">
            <xsl:for-each select="key('HEADERS',$ref)">
              <xsl:number level="any"/>
            </xsl:for-each>
          </xsl:variable>
          <w:headerReference w:type="{@type}" r:id="{concat('rId',100+$headernum)}"/>
        </xsl:if>
      </xsl:for-each>
      <w:pgSz>
        <xsl:choose>
          <!-- landscape -->
          <xsl:when test="teidocx:orientation/@type='landscape'">
            <xsl:attribute name="w:orient">landscape</xsl:attribute>
            <xsl:attribute name="w:w">15840</xsl:attribute>
            <xsl:attribute name="w:h">12240</xsl:attribute>
          </xsl:when>
          <!-- portrait -->
          <xsl:otherwise>
            <xsl:attribute name="w:w">12240</xsl:attribute>
            <xsl:attribute name="w:h">15840</xsl:attribute>
          </xsl:otherwise>
        </xsl:choose>
      </w:pgSz>
      <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:gutter="0" w:footer="720" w:header="720"/>
      <xsl:if test="teidocx:pageNumbering">
        <w:pgNumType>
          <xsl:if test="teidocx:pageNumbering/@start">
            <xsl:attribute name="w:start" select="teidocx:pageNumbering/@start"/>
          </xsl:if>
          <xsl:if test="teidocx:pageNumbering/@type">
            <xsl:attribute name="w:fmt" select="teidocx:pageNumbering/@type"/>
          </xsl:if>
        </w:pgNumType>
      </xsl:if>
      <xsl:if test="teidocx:header/@type='first' or teidocx:footer/@type='first'">
        <w:titlePg/>
      </xsl:if>
      <w:docGrid w:linePitch="360"/>
    </w:sectPr>
  </xsl:variable>
  <!-- write out sectPr -->
  <xsl:choose>
    <xsl:when test="$final-section='false'">
      <w:p>
        <w:pPr>
          <xsl:copy-of select="$sectPr"/>
        </w:pPr>
      </w:p>
    </xsl:when>
    <xsl:otherwise>
      <xsl:copy-of select="$sectPr"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/to/wordsections/wordsections.xsl