xslt - sort in xsl:apply-templates vs sort in xsl:for-each

loool

New Member
What are the flexibility and performance advantages between option (a) and (b)?Thanks in advance.xml data:\[code\]<grandparent gname="gname1"><parent pname="pname1"><child>cname1</child><child>cname2</child><child>cname3</child><child>cname4</child></parent><parent pname="pname2"><child>cname11</child><child>cname12</child><child>cname13</child><child>cname14</child></parent><parent pname="pname3"><child>cname21</child><child>cname22</child><child>cname23</child><child>cname24</child></parent><grandparent>\[/code\]partial xslt code:(a)\[code\]<xsl:apply-templates select="/grandparent/parent"> <xsl:sort select="@pname"/></xsl:apply-templates>\[/code\](b)\[code\]<xsl:templates match="/grandparent"> <xsl:for-each select="parent"> <xsl:sort select="@pname" order="descending"/> </xsl:for-each></xsl:template>\[/code\]
 
Back
Top