<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" encoding="utf-8"/> <xsl:template match="/"> <xsl:apply-templates select="//p"/> </xsl:template> <xsl:template match="p"> <xsl:for-each select="item"> <xsl:if test="(a[4] = 'NOUN' or a[4] = 'PROPN') and following-sibling::item[1]/a[4] = 'ADP' and (following-sibling::item[2]/a[4] = 'NOUN' or following-sibling::item[2]/a[4]='PROPN') and following-sibling::item[3]/a[4]='ADP'"> <xsl:value-of select="concat(a[2], ' ',following-sibling::item[1]/a[2], ' ', following-sibling::item[2]/a[2], ' ', following-sibling::item[3]/a[2])"/> <xsl:text>&#xD;&#xA;</xsl:text> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>