xslt for-each 和排序问题
xslt for-each and sorting issues
下面是我的 XLST。我的问题是为什么我的输出没有被正确排序??它应该按升序排序,我尝试在没有辅助模板的情况下这样做并且它有效,但是一旦在模板中使用它就不会输出排序。
XSLT 代码:
<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>`
看起来像而不是
<xsl:template match="movie">
<xsl:for-each select ="movies/movie">
你想要
<xsl:template match="movies">
<xsl:for-each select="movie">
下面是我的 XLST。我的问题是为什么我的输出没有被正确排序??它应该按升序排序,我尝试在没有辅助模板的情况下这样做并且它有效,但是一旦在模板中使用它就不会输出排序。
XSLT 代码:
<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>`
看起来像而不是
<xsl:template match="movie">
<xsl:for-each select ="movies/movie">
你想要
<xsl:template match="movies">
<xsl:for-each select="movie">