Use .. to indicate level
File: Data.xml <winelist> <wine grape="A"> <winery>shop 2</winery> <product>product 2</product> <year>2008</year> <prices> <list>10.99</list> <discounted>9.50</discounted> </prices> </wine> </winelist> File: Transform.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="no" /> <xsl:template match="winelist"> Wines needing their "discount" value set: <xsl:for-each select="wine/prices/discounted[not(text())]"> <xsl:value-of select="../../year" /> <xsl:text> </xsl:text> <xsl:value-of select="../../winery" /> <xsl:text> </xsl:text> <xsl:value-of select="../../product" /> </xsl:for-each> </xsl:template> </xsl:stylesheet>