Showing:

Documentation
Used by
References
Imported modules
Included from
Source
Stylesheet lists.xsl
Documentation

Description

TEI stylesheet for converting Word docx files to TEI

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: from.xsl 6832 2009-10-12 22:42:59Z rahtz $

Copyright: 2008, TEI Consortium

Imported modules
Included from
Template listSection
Documentation

Description

 
        This template handles lists and takes care of nested lists.
    
Namespace No namespace
Used by
References
Templates listSection; listType
Import precedence 10
Source
<xsl:template name="listSection">
  <xsl:variable name="level">
    <xsl:value-of select="w:pPr/w:pStyle/@w:val"/>
  </xsl:variable>
  <list>
    <xsl:call-template name="listType"/>
    <!-- Notes should be handled by a specific ISO handler -->
    <xsl:for-each-group select="current-group()" group-adjacent="if(w:pPr/w:pStyle/@w:val=$level)    then 0 else                  if(w:pPr/w:pStyle/@w:val='Note') then 0                     else 1">
      <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="contains(w:pPr/w:pStyle/@w:val,'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/lists.xsl
Template listType
Documentation

Description

        Trying to figure out the style of a list.
    
Namespace No namespace
Used by
Template listSection
References
Import precedence 10
Source
<xsl:template name="listType">
  <xsl:variable name="style">
    <xsl:value-of select="w:pPr/w:pStyle/@w:val"/>
  </xsl:variable>
  <xsl:variable name="type" select="teidocx:get-listtype($style)"/>
  <xsl:attribute name="type">
    <xsl:choose>
      <xsl:when test="string-length($type) > 0">
        <xsl:value-of select="$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(concat($word-directory,'/word/styles.xml'))//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(concat($word-directory,'/word/styles.xml'))//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(concat($word-directory,'/word/numbering.xml'))//w:num[@w:numId=$numbering-def]/w:abstractNumId/@w:val"/>
        <xsl:variable name="numfmt">
          <xsl:value-of select="document(concat($word-directory,'/word/numbering.xml'))//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="string-length($numfmt)=0">unordered</xsl:when>
          <xsl:when test="$numfmt='bullet'">unordered</xsl:when>
          <xsl:otherwise>ordered</xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:attribute>
</xsl:template>
Stylesheet location ../../../docx/from/lists/lists.xsl