I have a script that lists all the child elements of a page and sorts them by date. Instead, I want them to be sorted by pageTitle attribute however, once changing the select attribute in the sort code and refreshing the page, the list remains the same. here is my code:
Thanks for your reply. That did it! all works now.
I am using Umbraco 4.5.1 and this is something that is confusing me; I thought 4.5.1 used the new schema, however the legacy schema is what I am using for XSLT on the site and it is working, despite the fact that I cannot find any reference to the useLegacySchema attribute in any *.config file.... Is this normal?!
If you upgraded to v4.5.x from an earlier version, then the legacy XML schema is enabled by default.
The setting is in "~/config/umbracoSettings.config" if you wanted to change it ... but remember that you would need to republish all your content pages and modify all your XSLT accordingly.
I did find that when I switched an upgraded install over from legacy to new XML schema, the umbraco.config kept all the old nodes in there.
Only when I deleted the umbraco.config and "Republished entire site" (from right-clicking the root Content node) - that it only store the new XML schema nodes.
alphabetical sort not working
Hi all,
I have a script that lists all the child elements of a page and sorts them by date. Instead, I want them to be sorted by pageTitle attribute however, once changing the select attribute in the sort code and refreshing the page, the list remains the same. here is my code:
<xsl:for-each select="$currentPage/node[@nodeTypeAlias='FAQItem']">
<xsl:sort select="pageTitle" order="ascending" data-type="text" />
<xsl:if test="position() <= $numberOfItems">
<li>
<xsl:attribute name="class">bullet</xsl:attribute>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
Hi Max,
Which version of Umbraco are you using? or are you using the new or legacy XML schema?
Based on your loop, it looks like your using the legacy XML schema (from before Umbraco v4.5).
Try this XSLT:
I added the 2nd <xsl:sort> tag in there for any nodes that didn't have a "pageTitle" property to sort on ... feel free to remove it! ;-)
Cheers, Lee.
Hi,
Thanks for your reply. That did it! all works now.
I am using Umbraco 4.5.1 and this is something that is confusing me; I thought 4.5.1 used the new schema, however the legacy schema is what I am using for XSLT on the site and it is working, despite the fact that I cannot find any reference to the useLegacySchema attribute in any *.config file.... Is this normal?!
Thanks,
Max.
Hi Max,
If you upgraded to v4.5.x from an earlier version, then the legacy XML schema is enabled by default.
The setting is in "~/config/umbracoSettings.config" if you wanted to change it ... but remember that you would need to republish all your content pages and modify all your XSLT accordingly.
Cheers, Lee.
Ah I see, okay thanks very much.
incidentally, is it possible that a very old xslt cache meant that some old schema xslt would still work alongside some new, new schema xslt?
I did find that when I switched an upgraded install over from legacy to new XML schema, the umbraco.config kept all the old nodes in there.
Only when I deleted the umbraco.config and "Republished entire site" (from right-clicking the root Content node) - that it only store the new XML schema nodes.
Cheers, Lee.
That would explain it :)
Thanks.
Max,
is working on a reply...