Whe XSLT processor looks for a template, it searches the whole stylesheet, so it doesn't matter where the template is within that stylesheet. When the XSLT processor finds a matching template, it uses the content of the template to process the matching node and generate some output. Then content of the template might include insturctions that tell the processor to apply templates to a particular set of nodes, in which case it goes though those nodes finding the and processing matching templates, and so on.

        The process of applying templates to nodes int he node tree has to start somewhere. In the majority of cases, the input to the stylesheet is an XML document. After building the node tree, the XSLT processor takes the document node and tried to find a template that matches it. If the XSLT finds one, it process the content of that template to generate the output. For other templates, such as <xsl:template match="Channel"> the XSLT processor will never use this template unless you tell the processor to process a <Channel> element. You instruct the XSLT processor to apply templates to some nodes using the  <xsl:apply-templates> insturction.
        for example <xsl:apply-templates select="/TVGuide/Channel" />


        <pre data-sub="prettyprint:_">
        </pre>