<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" />
  <xsl:strip-space elements="*" />

  <!-- verbcontexts.xsl -->
  <!-- input ('primary annotation'): sentence info of citation -->
  <!-- output: for each sentence, output verbs + PoS info -->
  <!-- required secondary annotations: TnT sentence-wise -->

  <!-- params and vars for filename construction -->
  <xsl:param name="docid" select="'Cnn-mmmm'" />

  <!-- root: verbcontexts -->
  <xsl:template match="/">
    <verbcontexts docid="{$docid}">
      <xsl:apply-templates />
    </verbcontexts>
  </xsl:template>

  <!-- for each citation center sentence, output verbs + PoS info -->
  <xsl:template match="sentence">
    <xsl:variable name="filename"
      select='concat("../data/uebung03/",$docid,"-s",@no,"-p",@page,"-TnT.xml")' />
    <sentence no="{@no}" page="{@page}" citation="{../string/text()}">
      <text>
        <xsl:value-of select="text()" />
      </text>
      <verbs>
        <xsl:for-each
          select="document($filename)/tnt/tokens/w[p[starts-with(@pos, 'VB')]]">
          <xsl:copy-of select="." />
        </xsl:for-each>
      </verbs>
    </sentence>
  </xsl:template>

  <!-- kill text nodes in input -->
  <xsl:template match="text()" />

</xsl:stylesheet>


