Sidhartha Shenoy
Sidhartha Shenoy

Reputation: 179

XSL sort functionality

<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 ??

Upvotes: 0

Views: 195

Answers (1)

user357812
user357812

Reputation:

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.

Upvotes: 1

Related Questions