Mode:

Compact lists

Showing:

Documentation
Used by
References
Included from
Source
Stylesheet lists.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 listSection
Documentation

Description

 
        This template handles lists and takes care of nested lists.
    
Namespace No namespace
Used by
References
Templates
Function
Import precedence 7
Source
<xsl:template name="listSection">
  <xsl:variable name="type">
    <xsl:value-of select="w:pPr/w:pStyle/@w:val"/>
  </xsl:variable>
  <xsl:variable name="level">
    <xsl:value-of select="number(w:pPr/w:numPr/w:ilvl/@w:val)"/>
  </xsl:variable>
  <list>
    <xsl:call-template name="listType"/>
    <xsl:for-each-group select="current-group()" group-adjacent="if            (w:pPr/w:numPr/w:ilvl/@w:val  > $level) then 1            else if(w:pPr/w:pStyle/@w:val=$type)  then 0             else if(w:pPr/w:pStyle/@w:val='Note') then 0                             else if(w:pPr/w:pStyle/@w:val='dl') then 1                            else 0">
      <xsl:choose>
        <!-- we are still on the same level -->
        <xsl:when test="current-grouping-key()=0">
          <xsl:for-each select="current-group()">
            <!-- put items and notes as siblings  for now -->
            <xsl:choose>
              <xsl:when test="tei:is-list(.)">
                <item>
                  <xsl:apply-templates/>
                </item>
              </xsl:when>
              <xsl:otherwise>
                <xsl:apply-templates select="." mode="paragraph"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="listSection"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:for-each-group>
  </list>
</xsl:template>
Stylesheet location ../../../docx/from/lists.xsl
Template listType
Documentation

Description

        Trying to figure out the style of a list.
    
Namespace No namespace
Used by
Template
References
Import precedence 7
Source
<xsl:template name="listType">
  <xsl:variable name="style">
    <xsl:value-of select="w:pPr/w:pStyle/@w:val"/>
  </xsl:variable>
  <xsl:variable name="style.type" select="tei:get-listtype($style)"/>
  <xsl:variable name="type">
    <xsl:choose>
      <xsl:when test="string-length($style.type) > 0">
        <xsl:value-of select="$style.type"/>
      </xsl:when>
      <!-- try to figure it out by looking at the corresponding numbering file -->
      <xsl:otherwise>
        <!-- look up the numbering definition .. either in document.xml or in styles.xml  -->
        <xsl:variable name="numbering-def">
          <xsl:choose>
            <xsl:when test="w:pPr/w:numPr/w:numId/@w:val">
              <xsl:value-of select="w:pPr/w:numPr/w:numId/@w:val"/>
            </xsl:when>
            <xsl:otherwise>
              <!-- we might want to follow the basedOn reference, but not at the moment -->
              <xsl:value-of select="document($styleDoc)//w:style[w:name/@w:val=$style]/w:pPr/w:numPr/w:numId/@w:val"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <!-- look up the level .. either in document.xml or in styles.xml  -->
        <xsl:variable name="numbering-level">
          <xsl:choose>
            <xsl:when test="w:pPr/w:numPr/w:ilvl/@w:val">
              <xsl:value-of select="w:pPr/w:numPr/w:ilvl/@w:val"/>
            </xsl:when>
            <xsl:otherwise>
              <!-- we might want to follow the basedOn reference, but not at the moment -->
              <xsl:value-of select="document($styleDoc)//w:style[w:name/@w:val=$style]/w:pPr/w:numPr/w:ilvl/@w:val"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <!-- find the abstract numbering definition and then the corresponding numfmt -->
        <xsl:variable name="abstract-def" select="document($numberFile)//w:num[@w:numId=$numbering-def]/w:abstractNumId/@w:val"/>
        <xsl:variable name="numfmt">
          <xsl:value-of select="document($numberFile)//w:abstractNum[@w:abstractNumId=$abstract-def]/w:lvl[@w:ilvl=$numbering-level]/w:numFmt/@w:val"/>
        </xsl:variable>
        <!-- figure out what numbering scheme to use -->
        <xsl:choose>
          <xsl:when test="$style='dl'">gloss</xsl:when>
          <xsl:when test="string-length($numfmt)=0">simple</xsl:when>
          <xsl:when test="$numfmt='bullet'">bulleted</xsl:when>
          <xsl:otherwise>numbered</xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:attribute name="{if ($type = 'gloss') then 'type' else 'rend'}">
    <xsl:value-of select="$type"/>
  </xsl:attribute>
</xsl:template>
Stylesheet location ../../../docx/from/lists.xsl