<!--- Match toes element. ---> <xsl:template match="//toes"> OPEN-TOES <!--- Apply template to all the name nodes that are anywhere in the XML document (having nothing to do with the "toes" context node). ---> <xsl:apply-templates select="//name" /> CLOSE-TOES </xsl:template> <!--- Match name element. ---> <xsl:template match="name"> NAME </xsl:template>