FloatingText.xslt

From TEIWiki
Jump to navigation Jump to search

In P5, <text> is reserved for the major chunks of text that occur as the child of a <TEI> or <group>, and <floatingText> is used for the rest (e.g., as the child of <quote>).

<?xml version="1.0" encoding="UTF-8"?>
<!-- Tiny XSLT 1.0 stylesheet that reads in a TEI P4:2004 file (or -->
<!-- any other XML file, really) and writes out the same file with -->
<!-- <text> elements changed to <floatingText> elements, except for -->
<!-- those that are children of <TEI.2>, <TEI>, or <group>. -->

<!-- Copyleft 2008 Syd Bauman and the Brown University Women Writers Project -->

<!-- The output of this stylesheet is not P5-comnpliant XML; it is just -->
<!-- the same P4 document with <floatingText> instead of <text> in some -->
<!-- places. -->
<!-- Written 2008-05-02 by Syd Bauman -->

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:tei="http://www.tei-c.org/ns/1.0">
  
  <xsl:import href="Copy-All.xsl"/>
  
  <xsl:output method="xml"
    encoding="UTF-8"
    cdata-section-elements="eg"/>
  
  <xsl:template match="text[not(parent::TEI|parent::TEI.2|parent::group)]">
    <xsl:element name="floatingText">
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>