<?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" indent="yes" encoding="UTF-8"
media-type="text/xml"/>
<xsl:template match="/">
<body>
<xsl:for-each select="/corpus/body/s/graph">
   <xsl:variable name="curRt">
     <xsl:value-of select="@root"/>
   </xsl:variable>
   <xsl:if test="nonterminals/nt[@cat='S' and @id=$curRt]">
      <xsl:if test="not(nonterminals/nt/edge/@label='CD')">
         <xsl:if test="not(nonterminals/nt/edge/@label='CJ')">
	    <xsl:copy-of select="."/>
	 </xsl:if>
      </xsl:if>
   </xsl:if>
</xsl:for-each>
</body>
</xsl:template>
</xsl:stylesheet>

