Showing:

Documentation
Parameters
References
Imported modules
Included from
Source
Stylesheet graphics.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 w:drawing
Documentation

Description

Convert Word drawing objects
Namespace No namespace
Match w:drawing
Mode #default
References
Parameters
QName Namespace Tunnel
n No namespace yes
Import precedence 7
Source
<xsl:template match="w:drawing">
  <xsl:param name="n" tunnel="yes"/>
  <xsl:choose>
    <xsl:when test="$convert-graphics='true'">
      <xsl:choose>
        <xsl:when test="descendant::a:blip[1]/@r:embed">
          <graphic>
            <xsl:variable name="c">
              <xsl:choose>
                <xsl:when test="ancestor::w:tbl">
                  <xsl:number level="any" from="w:tbl"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:number level="any"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:variable>
            <xsl:attribute name="n">
              <xsl:choose>
                <xsl:when test="number($n)">
                  <xsl:value-of select="($n * 100) + $c"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>100</xsl:text>
                  <xsl:number level="any"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:attribute>
            <xsl:attribute name="width" select="concat(number(descendant::wp:extent[1]/@cx) div 360000,'cm')"/>
            <xsl:attribute name="height" select="concat(number(descendant::wp:extent[1]/@cy) div 360000,'cm')"/>
            <xsl:attribute name="url">
              <xsl:variable name="rid" select="descendant::a:blip[1]/@r:embed"/>
              <xsl:value-of select="document(concat($word-directory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
            </xsl:attribute>
            <!-- inline or block -->
            <xsl:attribute name="rend">
              <xsl:choose>
                <xsl:when test="wp:anchor">block</xsl:when>
                <xsl:otherwise>inline</xsl:otherwise>
              </xsl:choose>
            </xsl:attribute>
          </graphic>
        </xsl:when>
        <xsl:otherwise>
          <graphic> Linked Graphic: <xsl:variable name="rid" select="@r:link"/>
            <xsl:value-of select="document(concat($word-directory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
          </graphic>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <w:drawing>
        <xsl:apply-templates mode="iden"/>
      </w:drawing>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Stylesheet location ../../../docx/from/graphics/graphics.xsl
Template a:blipiden
Documentation

Description

Guides the identity transformation of blips
Namespace No namespace
Match a:blip
Mode iden
References
Parameter word-directory
Import precedence 7
Source
<xsl:template match="a:blip" mode="iden">
  <a:blip>
    <xsl:choose>
      <xsl:when test="@r:embed">
        <xsl:variable name="rid" select="@r:embed"/>
        <xsl:attribute name="r:embed">
          <xsl:value-of select="document(concat($word-directory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
        </xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="rid" select="@r:link"/>
        <xsl:attribute name="r:link">
          <xsl:value-of select="document(concat($word-directory,'/word/_rels/document.xml.rels'))//rel:Relationship[@Id=$rid]/@Target"/>
        </xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
  </a:blip>
</xsl:template>
Stylesheet location ../../../docx/from/graphics/graphics.xsl