views:

26

answers:

1
<xsl:apply-templates 
  select="$tempPosterItemNodeSet/CurrentPosterItemCollection/PosterItem" 
  mode="PosterItem">

    <xsl:sort 
      select="$tempPosterItemNodeSet/CurrentPosterItemCollection/PosterItem/Property[@name='WidgetID']" 
      data-type="number"/>

</xsl:apply-templates>

I need to xslt sort a nodeset that I am passing to a template in the sample I have put above.

Can anybody let me know How I can sort the above xsl logic ??

+1  A: 

I think this could work:

<xsl:apply-templates  
  select="$tempPosterItemNodeSet/CurrentPosterItemCollection/PosterItem"  
  mode="PosterItem"> 

    <xsl:sort  
      select="Property[@name='WidgetID']"  
      data-type="number"/> 

</xsl:apply-templates> 

From http://www.w3.org/TR/xslt#sorting

For each node to be processed, the expression is evaluated with that node as the current node and with the complete list of nodes being processed in unsorted order as the current node list.

Alejandro