Home  ›  BLOG  ›  2008  ›  8  ›  7  ›  Sort Umbraco Nodes by sortOrder property
Sort Umbraco Nodes by sortOrder property
Donnerstag, 07. August 2008, Christoph Ertl

Today I added two nodes, changed the sorting and published the whole bunch. The first look at the resulting page was surprising because the sort order seemed to be totally confused.

After a while I realized that I reached the count of 11 nodes and the node with the sortOrder = 10 was displayed after the one with sortOrder = 1.

Got it? The property is compared as string.

The problem is that XSLT handles values as string unless you declare what type should be used.

So instead of sorting nodes with

<xsl:sort
  
select="@sortOrder"
  
order="ascending"
/>

you have to set the data-type to be used for comparison

<xsl:sort
  
select="@sortOrder"
  
order="ascending"
  
data-type="number"
/>


0 Kommentare für “Sort Umbraco Nodes by sortOrder property”

    Leave a comment


    Not shown. Will only display your Gravatar picture from http://www.gravatar.com/


    (optional - remember http://)


    Enter the characters from the image. (used to avoid spam posts)