Mode:

Compact lists

Showing:

Documentation
Included from
Source
Stylesheet fields.xsl
Documentation

Description

TEI stylesheet for converting Word docx files to TEI

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 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

Copyright: 2013, TEI Consortium

Included from
Stylesheet version 3.0
Template w:fldSimple
Documentation

Description

Handle simple fields
Namespace No namespace
Match w:fldSimple
Mode #default
Import precedence 7
Source
<xsl:template match="w:fldSimple">
  <xsl:variable name="rstyle">
    <xsl:value-of select="w:r/w:rPr/w:rStyle/@w:val"/>
  </xsl:variable>
  <xsl:variable name="rends">
    <r>fldSimple</r>
    <xsl:if test="contains(@w:instr,'NOTEREF')">
      <r>noteref</r>
    </xsl:if>
    <xsl:if test="contains(@w:instr,'MERGEFORMAT')">
      <r>mergeformat</r>
    </xsl:if>
    <xsl:if test="contains(@w:instr,' \r')">
      <r>instr_r</r>
    </xsl:if>
    <xsl:if test="contains(@w:instr,' \f')">
      <r>instr_f</r>
    </xsl:if>
    <xsl:if test="contains(@w:instr,' \n')">
      <r>instr_n</r>
    </xsl:if>
  </xsl:variable>
  <!--      <xsl:message>rends=<xsl:copy-of select="$rends"/></xsl:message> -->
  <xsl:choose>
    <!-- cross ref -->
    <!-- <w:fldSimple w:instr=" REF _Ref260736521 \r \h  \* MERGEFORMAT ">            -->
    <xsl:when test="contains(@w:instr,'NOTEREF _Ref')">
      <xsl:variable name="ref">
        <xsl:value-of select="substring-before(substring-after(@w:instr,'_'),' ')"/>
      </xsl:variable>
      <ref>
        <xsl:attribute name="rend">
          <xsl:value-of select="string-join(($rends/tei:r),' ')"/>
        </xsl:attribute>
        <xsl:attribute name="target" select="concat('#',$ref)"/>
        <xsl:if test="$rstyle!=''">
          <xsl:attribute name="iso:class">
            <xsl:value-of select="$rstyle"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:apply-templates/>
      </ref>
    </xsl:when>
    <xsl:when test="contains(@w:instr,'REF _Ref')">
      <xsl:variable name="ref">
        <xsl:value-of select="substring-before(substring-after(@w:instr,'_'),' ')"/>
      </xsl:variable>
      <ref>
        <xsl:attribute name="rend">
          <xsl:value-of select="string-join(($rends/tei:r),' ')"/>
        </xsl:attribute>
        <xsl:attribute name="target" select="concat('#',$ref)"/>
        <xsl:if test="$rstyle!=''">
          <xsl:attribute name="iso:class">
            <xsl:value-of select="$rstyle"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:apply-templates/>
      </ref>
    </xsl:when>
    <xsl:when test="contains(@w:instr,'PAGE')">
      <!-- Page number -->
      <tei:dynamicContent type="pagenumber"/>
    </xsl:when>
    <xsl:when test="contains(@w:instr,'SEQ')"/>
    <!-- not sure -->
    <xsl:when test="contains(@w:instr,'INCLUDETEXT')"/>
    <!-- from docm to docx conversion? -->
    <xsl:when test="contains(@w:instr,'TEMPLATE')"/>
    <!-- from docm to docx conversion? -->
    <xsl:otherwise>
      <xsl:message terminate="yes">fldSimple: unrecognized type
        <xsl:value-of select="@w:instr"/>
      </xsl:message>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/fields.xsl