Revision 9d3cb802cf841b9e2a0a6902181513fa187de5f0 authored by Peter Stadler on 17 January 2020, 13:13:50 UTC, committed by Peter Stadler on 17 January 2020, 13:13:50 UTC
1 parent 97eac77
Raw File
subset.xsl
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xpath-default-namespace="http://www.tei-c.org/ns/1.0">

  <xsl:template match="/">
    <TEI xmlns="http://www.tei-c.org/ns/1.0">
      <xsl:copy-of select="TEI/teiHeader"/>
      <text>
	<xsl:for-each select="TEI/text/front">
	  <xsl:copy>
	    <xsl:call-template name="subdivs"/>
	  </xsl:copy>
	</xsl:for-each>
	<xsl:for-each select="TEI/text/body">
	  <xsl:copy>
	    <xsl:call-template name="subdivs"/>
	  </xsl:copy>
	</xsl:for-each>
	<xsl:for-each select="TEI/text/back">
	  <xsl:copy>
	    <xsl:call-template name="subdivs"/>
	  </xsl:copy>
	</xsl:for-each>
      </text>
    </TEI>
  </xsl:template>

  <xsl:template name="subdivs">
    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="@*|text()|processing-instruction()"/>
  
  <xsl:template match="*">
    <xsl:choose>
      <xsl:when test="self::div">
	<xsl:copy>
	  <xsl:copy-of select="@*"/>	  <xsl:copy-of select="head"/>
	  <xsl:apply-templates/>
	</xsl:copy>
      </xsl:when>
      <xsl:when test="self::elementSpec|self::macroSpec|self::classSpec|self::moduleSpec|self::dataSpec">
	<xsl:copy-of select="."/>
      </xsl:when>
      <xsl:otherwise>
	<xsl:apply-templates/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
	

</xsl:stylesheet>
back to top