Add indenting to make result line up better
File: Data.xml <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="figure/title"> <xsl:apply-templates /> </xsl:template> <xsl:template match="para" /> </xsl:stylesheet> 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="chapter"> Pictures: <xsl:for-each select="descendant::figure"> <xsl:value-of select="title" /> <xsl:text> </xsl:text> </xsl:for-each> Chapter: <xsl:apply-templates /> </xsl:template> </xsl:stylesheet>