Mode:

Compact lists

Showing:

Documentation
Used by
References
Included from
Source
Stylesheet relationships.xsl
Documentation

Description

TEI stylesheet for making Word docx files from TEI XML

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 All rights reserved. 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: relationships.xsl 10820 2012-09-17 10:11:19Z rahtz $

Copyright: 2008, TEI Consortium

Included from
Stylesheet version 2.0
Template write-docxfile-main-relationships
Documentation

Description

Write _rels/.rels
Namespace No namespace
Used by
Template
References
Parameter
Variable
Import precedence 15
Source
<xsl:template name="write-docxfile-main-relationships">
  <xsl:if test="$debug='true'">
    <xsl:message>Writing out
      <xsl:value-of select="concat($wordDirectory,'/_rels/.rels')"/>
    </xsl:message>
  </xsl:if>
  <xsl:result-document href="{concat($wordDirectory,'/_rels/.rels')}" standalone="yes">
    <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
      <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
      <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
      <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
      <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties" Target="docProps/custom.xml"/>
    </Relationships>
  </xsl:result-document>
</xsl:template>
Stylesheet location ../../../docx/to/docxfiles/relationships.xsl
Template write-docxfile-relationships
Documentation

Description

Write word/_rels/document.xml.rels
Namespace No namespace
Used by
Template
References
Import precedence 15
Source
<xsl:template name="write-docxfile-relationships">
  <xsl:if test="$debug='true'">
    <xsl:message>Writing out
      <xsl:value-of select="concat($wordDirectory,'/word/_rels/document.xml.rels')"/>
    </xsl:message>
  </xsl:if>
  <xsl:result-document href="{concat($wordDirectory,'/word/_rels/document.xml.rels')}" standalone="yes">
    <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
      <!-- Mandatory Relationships -->
      <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/>
      <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
      <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
      <Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/>
      <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/>
      <Relationship Id="rId9" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="comments.xml"/>
      <!-- odd stuff -->
      <Relationship Id="rId18" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/>
      <!-- Any raw blips left in? -->
      <xsl:for-each select="key('BLIP',1)">
        <xsl:choose>
          <xsl:when test="@r:embed">
            <Relationship Id="rId{position() + 200}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="{@r:embed}"/>
          </xsl:when>
          <xsl:otherwise>
            <Relationship Id="rId{position() + 200}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="{@r:link}" TargetMode="External"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
      <!-- TEI images -->
      <xsl:for-each select="key('GRAPHICS',1)">
        <xsl:variable name="n">
          <xsl:number level="any"/>
          <!--
		    <xsl:choose>
		      <xsl:when test="@n">
			<xsl:number level="any"/>
		      </xsl:when>
		      <xsl:otherwise>
			<xsl:number level="any"/>
		      </xsl:otherwise>
		    </xsl:choose>
		    -->
        </xsl:variable>
        <Relationship Id="rId{$n + 300}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/resource{$n}.{tokenize(@url,'\.')[last()]}"/>
      </xsl:for-each>
      <!-- hyperlinks -->
      <xsl:for-each select="key('TARGETS',1)">
        <xsl:if test="not(starts-with(@target,'#'))">
          <Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="{@target}" TargetMode="External">
            <xsl:attribute name="Id">
              <xsl:text>rId</xsl:text>
              <xsl:variable name="n">
                <xsl:number level="any"/>
              </xsl:variable>
              <xsl:value-of select="$n + 3000"/>
            </xsl:attribute>
          </Relationship>
        </xsl:if>
      </xsl:for-each>
      <!-- Formulas -->
      <xsl:for-each select="key('IMAGEDATA',1)">
        <Relationship Id="rId{position() + 1000}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="{@r:id}"/>
      </xsl:for-each>
      <xsl:for-each select="key('OLEOBJECTS',1)">
        <Relationship Id="rId{position() + 2000}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="{@r:id}"/>
      </xsl:for-each>
      <!-- our headers and footers -->
      <xsl:choose>
        <xsl:when test="count(key('ALLHEADERS',1))=0 and count(key('ALLFOOTERS',1))=0">
          <xsl:for-each select="document($defaultHeaderFooterFile)">
            <xsl:call-template name="writeRelationshipsHeadersAndFooters"/>
          </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="writeRelationshipsHeadersAndFooters"/>
        </xsl:otherwise>
      </xsl:choose>
    </Relationships>
  </xsl:result-document>
</xsl:template>
Stylesheet location ../../../docx/to/docxfiles/relationships.xsl
Template writeRelationshipsHeadersAndFooters
Namespace No namespace
Used by
References
Import precedence 15
Source
<xsl:template name="writeRelationshipsHeadersAndFooters">
  <xsl:for-each select="key('ALLFOOTERS',1)">
    <xsl:variable name="num">
      <xsl:number/>
    </xsl:variable>
    <Relationship xmlns="http://schemas.openxmlformats.org/package/2006/relationships" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="{concat('footer',position(),'.xml')}" Id="{concat('rId',100+$num)}"/>
  </xsl:for-each>
  <!-- count all footers -->
  <xsl:for-each select="key('ALLHEADERS',1)">
    <xsl:variable name="num">
      <xsl:number/>
    </xsl:variable>
    <Relationship xmlns="http://schemas.openxmlformats.org/package/2006/relationships" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="{concat('header',position(),'.xml')}" Id="{concat('rId',100+$num)}"/>
  </xsl:for-each>
</xsl:template>
Stylesheet location ../../../docx/to/docxfiles/relationships.xsl
Key TARGETS
Namespace No namespace
Match tei:ref[@target]|tei:ptr[@target]
Use 1
Used by
Source
<xsl:key name="TARGETS" use="1" match="tei:ref[@target]|tei:ptr[@target]"/>
Stylesheet location ../../../docx/to/docxfiles/relationships.xsl
Key GRAPHICS
Namespace No namespace
Match tei:graphic[@url]
Use 1
Used by
Source
<xsl:key name="GRAPHICS" use="1" match="tei:graphic[@url]"/>
Stylesheet location ../../../docx/to/docxfiles/relationships.xsl
Key OLEOBJECTS
Namespace No namespace
Match o:OLEObject
Use 1
Used by
Source
<xsl:key name="OLEOBJECTS" use="1" match="o:OLEObject"/>
Stylesheet location ../../../docx/to/docxfiles/relationships.xsl
Key IMAGEDATA
Namespace No namespace
Match v:imagedata
Use 1
Used by
Source
<xsl:key name="IMAGEDATA" use="1" match="v:imagedata"/>
Stylesheet location ../../../docx/to/docxfiles/relationships.xsl