Hi Reto,

I think sorting by a subselection is currently not supported by the sort
function. I have created an issue at
https://issues.apache.org/jira/browse/MARMOTTA-97 to solve it.

Setting the order and sorting method is supported though. In your case, you
would sort as follows:

fn:sort(dc:date, "date", "desc")

Greetings,

Sebastian


2013/2/18 Reto Bachmann-Gmür <[email protected]>

> So this is the template snipped that works well:
>
>             <@ldpath path="^ont:requestedEntity">
>                     <li class="LoggedRequest">
>                         Date: <@ldpath path="dc:date"/><br/>
>                         Agent: <@ldpath path="ont:userAgent"/>
>                     </li>
>             </@ldpath>
>
> The only issue with the above is, that the list isn't sorted.
>
> This was my first attempt sorting things by date:
>
>             <@ldpath path="^ont:requestedEntity">
>                 <@ldpath path="fn:sort(dc:date)">
>                     <li class="LoggedRequest">
>                         Date: <@ldpath path="dc:date"/><br/>
>                         Agent: <@ldpath path="ont:userAgent"/>
>                     </li>
>                 </@ldpath>
>             </@ldpath>
>
> Unfortunately this created the list items but the actual values where
> missing.
>
> I figured this was because the sort would expand the path to the literal
> value
>
>             <@ldpath path="^ont:requestedEntity">
>                 <@ldpath path="fn:sort(dc:date)">
>                     <li class="LoggedRequest">
>                         Date: <@ldpath path="."/><br/>
>                         Agent: <@ldpath path="^dc:date/ont:userAgent"/>
>                     </li>
>                 </@ldpath>
>             </@ldpath>
>
> With that it shows the value for the date but not for the agent.
>
> My questions:
> - How to sort the resource correcty by the dc:date property?
> - How do I set the order?
> - Given that the values are xsd:date literals, will  this sort them
> correctly in (reverse) chronological order?
>
> Cheers,
> Reto
>

Reply via email to