Below is my XLST. My question is why is my output not being sorted correctly?? It should be sorted by ascending, I tried doing this without the secondary template and it worked, but once used within a template it will not output sorted.
XSLT CODE:
    <xsl:template match="movie">
        <xsl:for-each select ="movies/movie">
            <xsl:sort select="title" order="ascending" />
            <tr>
                <td>
                    <xsl:value-of select ="@id"/>
                    <br></br>
                </td>
                <td>
                    <xsl:value-of select ="title"/>
                    <br></br>
                </td>
                <td>
                    <xsl:value-of select ="pdirector"/>
                    <br></br>
                </td>
                <td>
                    <xsl:value-of select ="year"/>
                    <br></br>
                </td>
            </tr>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>`
				
                        
It looks like instead of
you want