Mode:

Compact lists

Showing:

Documentation
Parameters
Used by
References
Imported from
Source
Stylesheet pass2.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

Id: $Id: pass2.xsl 12235 2013-06-10 11:44:57Z rahtz $

Copyright: 2013, TEI Consortium

Imported from
Stylesheet version 3.0
Template @*|comment()|processing-instruction()pass2
Namespace No namespace
Match @*|comment()|processing-instruction()
Mode pass2
Import precedence 6
Source
<xsl:template match="@*|comment()|processing-instruction()" mode="pass2">
  <xsl:copy-of select="."/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template *pass2
Namespace No namespace
Match *
Mode pass2
Import precedence 6
Source
<xsl:template match="*" mode="pass2">
  <xsl:variable name="temp">
    <xsl:copy>
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
    </xsl:copy>
  </xsl:variable>
  <xsl:apply-templates mode="spacepass" select="$temp"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template @*|text()|comment()|processing-instruction()spacepass
Namespace No namespace
Match @*|text()|comment()|processing-instruction()
Mode spacepass
Import precedence 6
Source
<xsl:template match="@*|text()|comment()|processing-instruction()" mode="spacepass">
  <xsl:copy-of select="."/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template *spacepass
Namespace No namespace
Match *
Mode spacepass
References
Parameter
Function
Import precedence 6
Source
<xsl:template match="*" mode="spacepass">
  <xsl:copy>
    <xsl:apply-templates select="@*" mode="spacepass"/>
    <xsl:choose>
      <xsl:when test="$preserveSpace='true'">
      </xsl:when>
      <xsl:when test="tei:isInline(.)  and (starts-with(text()[1],' ') or         ends-with(text()[last()],' ')) and not(*)">
        <xsl:attribute name="xml:space">preserve</xsl:attribute>
      </xsl:when>
    </xsl:choose>
    <xsl:apply-templates select="*|processing-instruction()|comment()|text()" mode="spacepass"/>
  </xsl:copy>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template @xml:space[.='preserve']spacepass
Namespace No namespace
Match @xml:space[.='preserve']
Mode spacepass
References
Parameter
Import precedence 6
Source
<xsl:template match="@xml:space[.='preserve']" mode="spacepass">
  <xsl:if test="$preserveSpace='true'">
    <xsl:copy-of select="."/>
  </xsl:if>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template text()pass2
Namespace No namespace
Match text()
Mode pass2
Import precedence 6
Source
<xsl:template match="text()" mode="pass2">
  <xsl:value-of select="."/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:p[not(.//tei:pb) and normalize-space(.)='']pass2
Documentation

Description

zap empty p

Namespace No namespace
Match tei:p[not(.//tei:pb) and normalize-space(.)='']
Mode pass2
Import precedence 6
Priority 99
Source
<xsl:template match="tei:p[not(.//tei:pb) and normalize-space(.)='']" mode="pass2" priority="99"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:figure/tei:p[.//tei:graphic]pass2
Namespace No namespace
Match tei:figure/tei:p[.//tei:graphic]
Mode pass2
Import precedence 6
Priority 101
Source
<xsl:template match="tei:figure/tei:p[.//tei:graphic]" mode="pass2" priority="101">
  <xsl:choose>
    <xsl:when test="preceding-sibling::tei:p[.//tei:graphic]">
      <figure>
        <xsl:apply-templates select="*" mode="pass2"/>
      </figure>
    </xsl:when>
    <xsl:when test="following-sibling::tei:p[.//tei:graphic]">
      <figure>
        <xsl:apply-templates select="*" mode="pass2"/>
      </figure>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="*" mode="pass2"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:cell[count(*)=1]/tei:ppass2
Documentation

Description

Singleton paragraphs in cells dropped
Namespace No namespace
Match tei:cell[count(*)=1]/tei:p
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:cell[count(*)=1]/tei:p" mode="pass2">
  <xsl:apply-templates mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:list[normalize-space(.)='']pass2
Namespace No namespace
Match tei:list[normalize-space(.)='']
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:list[normalize-space(.)='']" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:list/tei:listpass2
Documentation

Description

Inner lists in lists must be moved to inside items

Namespace No namespace
Match tei:list/tei:list
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:list/tei:list" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:itempass2
Namespace No namespace
Match tei:item
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:item" mode="pass2">
  <xsl:choose>
    <xsl:when test="not(*) and string-length(.)=0"/>
    <xsl:otherwise>
      <item>
        <xsl:copy-of select="@*"/>
        <xsl:variable name="me" select="generate-id()"/>
        <xsl:apply-templates mode="pass2"/>
        <xsl:for-each select="following-sibling::tei:list[preceding-sibling::tei:item[1][generate-id()=$me]]">
          <list>
            <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
          </list>
        </xsl:for-each>
      </item>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:head/text()pass2
Documentation

Description

Zap emdashes at start of head

Namespace No namespace
Match tei:head/text()
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:head/text()" mode="pass2">
  <xsl:choose>
    <xsl:when test="starts-with(.,'— ')">
      <xsl:value-of select="substring(.,3)"/>
    </xsl:when>
    <xsl:when test="starts-with(.,' — ')">
      <xsl:value-of select="substring(.,4)"/>
    </xsl:when>
    <xsl:when test="starts-with(.,' — ')">
      <xsl:value-of select="substring(.,4)"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="."/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:seg[not(@*)]pass2
Documentation

Description

A <p> or <seg> which does nothing is not worth having; and if its reverts to just space, its a space

Namespace No namespace
Match tei:seg[not(@*)]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:seg[not(@*)]" mode="pass2">
  <xsl:choose>
    <xsl:when test="parent::tei:formula and normalize-space(.)=''"/>
    <xsl:when test=".=' ' and         following-sibling::node()[1][self::tei:hi]/@rend=preceding-sibling::node()[1][self::tei:hi]/@rend">
    </xsl:when>
    <xsl:when test="parent::*/text()">
      <xsl:value-of select="."/>
    </xsl:when>
    <xsl:when test="parent::tei:hi[count(*)=1]">
      <xsl:value-of select="."/>
    </xsl:when>
    <xsl:when test=".=' '">
      <xsl:value-of select="."/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:copy-of select="."/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:textpass2
Documentation

Description

Look at the sections we have generated, and put them in <front> or <body> as appropriate

Namespace No namespace
Match tei:text
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:text" mode="pass2">
  <text>
    <xsl:for-each select="tei:fw">
      <xsl:copy-of select="."/>
    </xsl:for-each>
    <xsl:apply-templates select="//tei:front" mode="pass2"/>
    <body>
      <xsl:for-each select="tei:body/tei:*[not(local-name(.)='front')]">
        <xsl:apply-templates select="." mode="pass2"/>
      </xsl:for-each>
    </body>
    <xsl:apply-templates select="tei:back" mode="pass2"/>
  </text>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:listBibl/tei:ppass2
Documentation

Description

A <p> inside a listBibl is moved out

Namespace No namespace
Match tei:listBibl/tei:p
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:listBibl/tei:p" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:listBiblpass2
Namespace No namespace
Match tei:listBibl
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:listBibl" mode="pass2">
  <xsl:for-each select="tei:p">
    <p>
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
    </p>
  </xsl:for-each>
  <listBibl>
    <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
  </listBibl>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:GLOSSITEMpass2
Documentation

Description

Gloss list from tei to docx

Namespace No namespace
Match tei:GLOSSITEM
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:GLOSSITEM" mode="pass2">
  <label>
    <xsl:for-each select="tei:hi">
      <xsl:apply-templates mode="pass2"/>
    </xsl:for-each>
  </label>
  <item>
    <xsl:apply-templates mode="inglossitem"/>
  </item>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template *inglossitem
Namespace No namespace
Match *
Mode inglossitem
Import precedence 6
Source
<xsl:template match="*" mode="inglossitem">
  <xsl:apply-templates select="." mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:lbinglossitem
Namespace No namespace
Match tei:lb
Mode inglossitem
Import precedence 6
Source
<xsl:template match="tei:lb" mode="inglossitem"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[tei:match(@rend,'bold')]inglossitem
Namespace No namespace
Match tei:hi[tei:match(@rend,'bold')]
Mode inglossitem
References
Import precedence 6
Source
<xsl:template match="tei:hi[tei:match(@rend,'bold')]" mode="inglossitem"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:list[@type='gloss']/tei:label[.='where']pass2
Documentation

Description

Top of a weird gloss list

Namespace No namespace
Match tei:list[@type='gloss']/tei:label[.='where']
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:list[@type='gloss']/tei:label[.='where']" mode="pass2">
  <head>
    <xsl:apply-templates/>
  </head>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:bibl/tei:g[@ref='x:tab']pass2
Documentation

Description

A tab in a <bibl>? no.

Namespace No namespace
Match tei:bibl/tei:g[@ref='x:tab']
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:bibl/tei:g[@ref='x:tab']" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:gloss//tei:g[@ref='x:tab']pass2
Documentation

Description

A tab in a <gloss>? no.

Namespace No namespace
Match tei:gloss//tei:g[@ref='x:tab']
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:gloss//tei:g[@ref='x:tab']" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:head/tei:g[@ref='x:tab']pass2
Documentation

Description

A tab in a <head>? no.

Namespace No namespace
Match tei:head/tei:g[@ref='x:tab']
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:head/tei:g[@ref='x:tab']" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:item[not(*) and not(text())]pass2
Documentation

Description

An empty item

Namespace No namespace
Match tei:item[not(*) and not(text())]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:item[not(*) and not(text())]" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:bibl[not(*) and not(text())]pass2
Documentation

Description

Zap empty <bibl>
Namespace No namespace
Match tei:bibl[not(*) and not(text())]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:bibl[not(*) and not(text())]" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:availability[not(*) and not(text())]pass2
Documentation

Description

Zap empty <availability>
Namespace No namespace
Match tei:availability[not(*) and not(text())]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:availability[not(*) and not(text())]" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:note[not(*) and not(text())]pass2
Documentation

Description

Zap empty <note>
Namespace No namespace
Match tei:note[not(*) and not(text())]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:note[not(*) and not(text())]" mode="pass2">
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:list[@type='gloss']/tei:item/tei:g[@ref='x:tab']pass2
Namespace No namespace
Match tei:list[@type='gloss']/tei:item/tei:g[@ref='x:tab']
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:list[@type='gloss']/tei:item/tei:g[@ref='x:tab']" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[tei:match(@rend,'footnote_reference') and count(*)=1 and tei:seg and normalize-space(.)='']pass2
Documentation

Description

zap footnote reference which only contains a space
Namespace No namespace
Match tei:hi[tei:match(@rend,'footnote_reference') and count(*)=1 and tei:seg and normalize-space(.)='']
Mode pass2
References
Import precedence 6
Priority 99
Source
<xsl:template match="tei:hi[tei:match(@rend,'footnote_reference') and          count(*)=1 and tei:seg and          normalize-space(.)='']" mode="pass2" priority="99">
  <xsl:text> </xsl:text>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[tei:match(@rend,'footnote_reference') and count(*)=1 and tei:note]pass2
Documentation

Description

A footnote reference with a footnote inside it is in fact just a footnote
Namespace No namespace
Match tei:hi[tei:match(@rend,'footnote_reference') and count(*)=1 and tei:note]
Mode pass2
References
Import precedence 6
Priority 99
Source
<xsl:template match="tei:hi[tei:match(@rend,'footnote_reference') and count(*)=1 and tei:note]" mode="pass2" priority="99">
  <xsl:apply-templates select="tei:note" mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[tei:match(@rend,'Endnote_anchor')]pass2
Namespace No namespace
Match tei:hi[tei:match(@rend,'Endnote_anchor')]
Mode pass2
References
Import precedence 6
Priority 99
Source
<xsl:template match="tei:hi[tei:match(@rend,'Endnote_anchor')]" mode="pass2" priority="99">
  <xsl:apply-templates mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[tei:match(@rend,'EndnoteReference')]pass2
Namespace No namespace
Match tei:hi[tei:match(@rend,'EndnoteReference')]
Mode pass2
References
Import precedence 6
Priority 99
Source
<xsl:template match="tei:hi[tei:match(@rend,'EndnoteReference')]" mode="pass2" priority="99">
  <xsl:apply-templates mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[tei:match(@rend,'EndnoteCharacters')]pass2
Namespace No namespace
Match tei:hi[tei:match(@rend,'EndnoteCharacters')]
Mode pass2
References
Import precedence 6
Priority 99
Source
<xsl:template match="tei:hi[tei:match(@rend,'EndnoteCharacters')]" mode="pass2" priority="99">
  <xsl:apply-templates mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[not(@rend) and not(*) and string-length(.)=0]pass2
Documentation

Description

a <hi> with just white space is ignored
Namespace No namespace
Match tei:hi[not(@rend) and not(*) and string-length(.)=0]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:hi[not(@rend) and not(*) and          string-length(.)=0]" mode="pass2">
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[not (* or text())]pass2
Documentation

Description

Clean up by merging adjacent <hi>s with the same rend value into one.
Namespace No namespace
Match tei:hi[not (* or text())]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:hi[not (* or text())]" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:hi[(@rend or @style) and (* or text())]pass2
Namespace No namespace
Match tei:hi[(@rend or @style) and (* or text())]
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:hi[(@rend or @style) and (* or text())]" mode="pass2">
  <xsl:variable name="r" select="concat(@rend,@style)"/>
  <xsl:choose>
    <xsl:when test="count(parent::tei:speaker/*)=1 and not         (parent::tei:speaker/text())">
      <xsl:apply-templates/>
    </xsl:when>
    <xsl:when test="parent::tei:head and .=' '"/>
    <xsl:when test="parent::tei:item/parent::tei:list[@type='gloss']  and tei:g[@ref='x:tab']"/>
    <!-- 
           The following when statements make sure that tei:hi with the same @rend and @style are merged
           together. We assume that the first tei:hi with text data will be processed and will pull in
           text data from immediately following tei:hi elements. Therefore, tei:hi elements with a preceding
           tei:hi with the same @rend and @style will *not* be processed.
      -->
    <xsl:when test="preceding-sibling::node()[1][self::tei:hi[concat(@rend,@style)=$r][* or text()]]"/>
    <xsl:when test="preceding-sibling::node()[1][self::tei:seg and .=' ']   and  preceding-sibling::node()[2][self::tei:hi[concat(@rend,@style)=$r]]"/>
    <xsl:when test="($r='bold' or $r='italic') and .=' '">
      <xsl:text> </xsl:text>
      <xsl:if test="following-sibling::node()[1][self::tei:hi[concat(@rend,@style)=$r]]">
        <xsl:variable name="ename" select="tei:nameOutputElement(.)"/>
        <xsl:element name="{$ename}">
          <xsl:copy-of select="@*[not(starts-with(.,'tei:'))]"/>
          <xsl:call-template name="nextHi">
            <xsl:with-param name="r" select="$r"/>
          </xsl:call-template>
        </xsl:element>
      </xsl:if>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="ename" select="tei:nameOutputElement(.)"/>
      <xsl:element name="{$ename}">
        <xsl:apply-templates mode="pass2" select="@*[not(starts-with(.,'tei:'))]"/>
        <xsl:choose>
          <xsl:when test="$ename='gap'">
            <desc>
              <xsl:apply-templates mode="pass2"/>
              <xsl:call-template name="nextHi">
                <xsl:with-param name="r" select="$r"/>
              </xsl:call-template>
            </desc>
          </xsl:when>
          <xsl:otherwise>
            <xsl:apply-templates mode="pass2"/>
            <xsl:call-template name="nextHi">
              <xsl:with-param name="r" select="$r"/>
            </xsl:call-template>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:element>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template nextHi
Namespace No namespace
Used by
References
Template
Parameters
QName Namespace
r No namespace
Import precedence 6
Source
<xsl:template name="nextHi">
  <xsl:param name="r"/>
  <xsl:for-each select="following-sibling::node()[1]">
    <xsl:choose>
      <xsl:when test="self::tei:hi[concat(@rend,@style)=$r]">
        <xsl:apply-templates mode="pass2"/>
        <xsl:call-template name="nextHi">
          <xsl:with-param name="r" select="$r"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="self::tei:seg and .=' ' and       following-sibling::node()[1][self::tei:hi[concat(@rend,@style)=$r]]">
        <xsl:apply-templates mode="pass2"/>
        <xsl:call-template name="nextHi">
          <xsl:with-param name="r" select="$r"/>
        </xsl:call-template>
      </xsl:when>
    </xsl:choose>
  </xsl:for-each>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:div[tei:head/tei:ANCHOR]pass2
Namespace No namespace
Match tei:div[tei:head/tei:ANCHOR]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:div[tei:head/tei:ANCHOR]" mode="pass2">
  <xsl:copy>
    <xsl:attribute name="xml:id" select="tei:head/tei:ANCHOR[1]/@xml:id"/>
    <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()" mode="pass2"/>
  </xsl:copy>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:ANCHOR[parent::tei:head]pass2
Namespace No namespace
Match tei:ANCHOR[parent::tei:head]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:ANCHOR[parent::tei:head]" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:ANCHOR[not(parent::tei:head)]pass2
Namespace No namespace
Match tei:ANCHOR[not(parent::tei:head)]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:ANCHOR[not(parent::tei:head)]" mode="pass2">
  <anchor xml:id="{@xml:id}"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template w:bookmarkStartpass2
Namespace No namespace
Match w:bookmarkStart
Mode pass2
Import precedence 6
Source
<xsl:template match="w:bookmarkStart" mode="pass2">
  <anchor>
    <xsl:attribute name="xml:id">
      <xsl:value-of select="replace(@w:name,'^_','')"/>
    </xsl:attribute>
  </anchor>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:speechpass2
Namespace No namespace
Match tei:speech
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:speech" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:speechkeep
Namespace No namespace
Match tei:speech
Mode keep
Import precedence 6
Source
<xsl:template match="tei:speech" mode="keep">
  <p>
    <xsl:apply-templates mode="pass2"/>
  </p>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:speakerpass2
Namespace No namespace
Match tei:speaker
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:speaker" mode="pass2">
  <sp>
    <speaker>
      <xsl:choose>
        <xsl:when test="count(*)=1 and not(text()) and tei:hi[@rend]">
          <xsl:attribute name="rend" select="tei:hi/@rend"/>
          <xsl:for-each select="tei:hi">
            <xsl:apply-templates mode="pass2"/>
          </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates mode="pass2"/>
        </xsl:otherwise>
      </xsl:choose>
    </speaker>
    <xsl:apply-templates select="following-sibling::tei:speech[1]" mode="keep"/>
  </sp>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:CAPTIONpass2
Documentation

Description

<CAPTION> belongs to nearest figure or table. Tables with multi-paragraph preceding CAPTIONs or with following captions are wrapped in a figure and the first para becomes a <head>, while subsequent ones become <figDescs>. A single preceding CAPTION paragraph becomes an internal header. Figure captions become headers and figDescs in a similar way.
Namespace No namespace
Match tei:CAPTION
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:CAPTION" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:tablepass2
Namespace No namespace
Match tei:table
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:table" mode="pass2">
  <xsl:variable name="preceding-caption" select="preceding-sibling::*[1][self::tei:CAPTION][string-length(string-join(.//text(), '')) gt 0]"/>
  <xsl:variable name="following-caption" select="following-sibling::*[1][self::tei:CAPTION][string-length(string-join(.//text(), '')) gt 0]"/>
  <xsl:if test="preceding-sibling::*[1][self::tei:CAPTION] and        following-sibling::*[1][self::tei:CAPTION]">
    <xsl:message>
      <xsl:text>WARN: Possible confusion on where these captions belong: [[</xsl:text>
      <xsl:value-of select="concat(preceding-sibling::*[1],']] and [[',           following-sibling::*[1],']]')"/>
    </xsl:message>
  </xsl:if>
  <xsl:choose>
    <xsl:when test="$preceding-caption[count(tei:p) gt 1] or $following-caption">
      <figure>
        <xsl:if test="$preceding-caption">
          <head>
            <xsl:apply-templates select="$preceding-caption/tei:p[1]/node()" mode="pass2"/>
          </head>
        </xsl:if>
        <xsl:for-each select="$preceding-caption/tei:p[position() gt 1]">
          <p>
            <xsl:apply-templates select="@*" mode="pass2"/>
            <xsl:apply-templates mode="pass2"/>
          </p>
        </xsl:for-each>
        <xsl:copy>
          <xsl:apply-templates select="@*" mode="pass2"/>
          <xsl:apply-templates mode="pass2"/>
        </xsl:copy>
        <xsl:for-each select="$following-caption/tei:p">
          <head>
            <xsl:apply-templates mode="pass2"/>
          </head>
        </xsl:for-each>
      </figure>
    </xsl:when>
    <xsl:otherwise>
      <xsl:copy>
        <xsl:apply-templates select="@*" mode="pass2"/>
        <xsl:if test="count($preceding-caption/tei:p) = 1">
          <head>
            <xsl:apply-templates select="$preceding-caption/tei:p/node()" mode="pass2"/>
          </head>
        </xsl:if>
        <xsl:apply-templates mode="pass2"/>
      </xsl:copy>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:figurepass2
Namespace No namespace
Match tei:figure
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:figure" mode="pass2">
  <xsl:variable name="preceding-caption" select="preceding-sibling::*[1][self::tei:CAPTION][string-length(string-join(.//text(), '')) gt 0]"/>
  <xsl:variable name="following-caption" select="following-sibling::*[1][self::tei:CAPTION][string-length(string-join(.//text(), '')) gt 0]"/>
  <xsl:if test="preceding-sibling::*[1][self::tei:CAPTION] and        following-sibling::*[1][self::tei:CAPTION]">
    <xsl:message>
      <xsl:text>WARN: Possible confusion on where these captions belong: [[</xsl:text>
      <xsl:value-of select="concat(preceding-sibling::*[1],']] and [[',           following-sibling::*[1],']]')"/>
    </xsl:message>
  </xsl:if>
  <xsl:copy>
    <xsl:if test="$preceding-caption">
      <head>
        <xsl:apply-templates select="$preceding-caption/tei:p[1]/node()" mode="pass2"/>
      </head>
    </xsl:if>
    <xsl:for-each select="$preceding-caption/tei:p[position() gt 1]">
      <p>
        <xsl:apply-templates mode="pass2"/>
      </p>
    </xsl:for-each>
    <xsl:apply-templates select="@*" mode="pass2"/>
    <xsl:apply-templates mode="pass2"/>
    <xsl:for-each select="$following-caption/tei:p">
      <head>
        <xsl:apply-templates mode="pass2"/>
      </head>
    </xsl:for-each>
  </xsl:copy>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:p[starts-with(@rend,'tei:')]pass2
Documentation

Description

Rename <p> to a more specific name based on @rend
Namespace No namespace
Match tei:p[starts-with(@rend,'tei:')]
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:p[starts-with(@rend,'tei:')]" mode="pass2">
  <xsl:element name="{tei:nameOutputElement(.)}">
    <xsl:copy-of select="@*[not(starts-with(.,'tei:'))]"/>
    <xsl:apply-templates mode="pass2"/>
  </xsl:element>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:div[count(*)=1 and tei:head[not(node())]]pass2
Documentation

Description

a div with no content but an empty head isn't needed
Namespace No namespace
Match tei:div[count(*)=1 and tei:head[not(node())]]
Mode pass2
Import precedence 6
Priority 21
Source
<xsl:template match="tei:div[count(*)=1 and tei:head[not(node())]]" mode="pass2" priority="21"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:div[count(parent::*/tei:div)=1 and not(tei:div) and tei:head[not(node())]]pass2
Documentation

Description

a singleton div with an empty head and no div children is bypassed
Namespace No namespace
Match tei:div[count(parent::*/tei:div)=1 and not(tei:div) and tei:head[not(node())]]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:div[count(parent::*/tei:div)=1 and          not(tei:div) and          tei:head[not(node())]]" mode="pass2">
  <xsl:apply-templates select="*[not(self::tei:head)]" mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:head[not(node())]pass2
Documentation

Description

an empty head is bypassed
Namespace No namespace
Match tei:head[not(node())]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:head[not(node())]" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:figure/tei:p[tei:match(@rend,'caption') or tei:match(@rend,'Figure title')]/text()[starts-with(.,'Figure ')]pass2
Namespace No namespace
Match tei:figure/tei:p[tei:match(@rend,'caption') or tei:match(@rend,'Figure title')]/text()[starts-with(.,'Figure ')]
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:figure/tei:p[tei:match(@rend,'caption') or tei:match(@rend,'Figure title')]/text()[starts-with(.,'Figure  ')]" mode="pass2">
  <xsl:value-of select="substring(.,9)"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template @rend[.='Body_Text']pass2
Namespace No namespace
Match @rend[.='Body_Text']
Mode pass2
Import precedence 6
Source
<xsl:template match="@rend[.='Body_Text']" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template @rend[.='Normal (Web)']pass2
Namespace No namespace
Match @rend[.='Normal (Web)']
Mode pass2
Import precedence 6
Source
<xsl:template match="@rend[.='Normal (Web)']" mode="pass2"/>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:p[tei:match(@rend,'caption') or tei:match(@rend,'Figure title')]pass2
Namespace No namespace
Match tei:p[tei:match(@rend,'caption') or tei:match(@rend,'Figure title')]
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:p[tei:match(@rend,'caption') or tei:match(@rend,'Figure title')]" mode="pass2">
  <head>
    <xsl:apply-templates mode="pass2"/>
  </head>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:p[matches(@rend, '.+[Tt]itle') and ancestor::tei:front]pass2
Namespace No namespace
Match tei:p[matches(@rend, '.+[Tt]itle') and ancestor::tei:front]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:p[matches(@rend, '.+[Tt]itle') and ancestor::tei:front]" mode="pass2">
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:p[tei:match(@rend,'Title') and ancestor::tei:front]pass2
Documentation

Description

Title is supposed to be the document title, its siblings form other title parts
Namespace No namespace
Match tei:p[tei:match(@rend,'Title') and ancestor::tei:front]
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:p[tei:match(@rend,'Title') and ancestor::tei:front]" mode="pass2">
  <docTitle>
    <titlePart type="{@rend}">
      <xsl:apply-templates mode="pass2"/>
    </titlePart>
    <xsl:for-each select="following-sibling::*[self::tei:p[matches(@rend,'.*[Tt]itle')]]">
      <titlePart type="{@rend}">
        <xsl:apply-templates mode="pass2"/>
      </titlePart>
    </xsl:for-each>
  </docTitle>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:p[tei:match(@rend,'Author') and ancestor::tei:front]pass2
Namespace No namespace
Match tei:p[tei:match(@rend,'Author') and ancestor::tei:front]
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:p[tei:match(@rend,'Author') and ancestor::tei:front]" mode="pass2">
  <docAuthor>
    <xsl:apply-templates mode="pass2"/>
  </docAuthor>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:p[tei:match(@rend,'Date') and ancestor::tei:front]pass2
Namespace No namespace
Match tei:p[tei:match(@rend,'Date') and ancestor::tei:front]
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:p[tei:match(@rend,'Date') and ancestor::tei:front]" mode="pass2">
  <docDate>
    <xsl:apply-templates mode="pass2"/>
  </docDate>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:titlePage[not(ancestor::tei:front)]pass2
Namespace No namespace
Match tei:titlePage[not(ancestor::tei:front)]
Mode pass2
Import precedence 6
Source
<xsl:template match="tei:titlePage[not(ancestor::tei:front)]" mode="pass2">
  <!-- strip unnecessary title Pages -->
  <xsl:message>STRIP TP</xsl:message>
  <xsl:apply-templates mode="pass2"/>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Template tei:refpass2
Documentation

Description

clean up mess left by w:instrText in the ref element
Namespace No namespace
Match tei:ref
Mode pass2
References
Import precedence 6
Source
<xsl:template match="tei:ref" mode="pass2">
  <xsl:variable name="target">
    <xsl:choose>
      <xsl:when test="tei:discardInstruction(@target)"/>
      <xsl:otherwise>
        <xsl:sequence select="tei:processInstruction(@target)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="tei:biblioInstruction($target)">
      <xsl:processing-instruction name="biblio">
        <xsl:value-of select="$target"/>
      </xsl:processing-instruction>
      <xsl:apply-templates mode="pass2"/>
    </xsl:when>
    <xsl:when test="matches(@target,'^LINK Excel.Sheet.')">
      <xsl:sequence select="tei:docxError('cannot embed Excel  spreadsheet')"/>
    </xsl:when>
    <xsl:when test="tei:ref">
      <xsl:apply-templates mode="pass2"/>
    </xsl:when>
    <xsl:when test=".=''"/>
    <xsl:when test="$target='' and @type">
      <xsl:copy>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates mode="pass2"/>
      </xsl:copy>
    </xsl:when>
    <xsl:when test="$target=''">
      <xsl:apply-templates mode="pass2"/>
    </xsl:when>
    <xsl:otherwise>
      <ref target="{$target}">
        <xsl:copy-of select="@rend"/>
        <xsl:apply-templates mode="pass2"/>
      </ref>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/pass2.xsl
Variable dq
Namespace No namespace
Used by
Source
<xsl:variable name="dq">"</xsl:variable>
Stylesheet location ../../../docx/from/pass2.xsl
Function tei:nameOutputElement (context)
Documentation

Description

Name for output element. If @rend starts with "TEI " or "tei:", rename the <hi> to the element name instead
Namespace http://www.tei-c.org/ns/1.0
Used by
References
Parameters
QName Namespace
context No namespace
Import precedence 6
Source
<xsl:function name="tei:nameOutputElement">
  <xsl:param name="context"/>
  <xsl:for-each select="$context">
    <xsl:choose>
      <xsl:when test="tei:match(@rend,'italic') and ancestor::tei:bibl">title</xsl:when>
      <xsl:when test="starts-with(@rend,'tei:')">
        <xsl:value-of select="substring(@rend,5)"/>
      </xsl:when>
      <xsl:when test="starts-with(@rend,'TEI ')">
        <xsl:value-of select="substring(@rend,5)"/>
      </xsl:when>
      <xsl:when test="self::tei:p">
        <xsl:text>p</xsl:text>
      </xsl:when>
      <xsl:when test="tei:match(@rend,'foreign')">
        <xsl:text>foreign</xsl:text>
      </xsl:when>
      <xsl:otherwise>hi</xsl:otherwise>
    </xsl:choose>
  </xsl:for-each>
</xsl:function>
Stylesheet location ../../../docx/from/pass2.xsl