AW: AW: Sort directory-list

Von: Martin Honnen <martin.honnen@gmx.de>
Gesendet: Sonntag, 24. November 2024 20:05
An: xproc-dev@w3.org
Betreff: Re: AW: Sort directory-list



On 21/11/2024 16:15, denis.maier@unibe.ch<mailto:denis.maier@unibe.ch> wrote:
Von: Martin Honnen <martin.honnen@gmx.de><mailto:martin.honnen@gmx.de>
On 21/11/2024 15:43, denis.maier@unibe.ch<mailto:denis.maier@unibe.ch> wrote:
Hi everyone,

I'm processing a directory containing files with names like something1, something2, ..., something10, something11, ..., something100, something101...
This messes up the sorting when I'm reading those files with p:directory-list, as someting10, something11, someting100, and something101 come before something2. I could preprocess the files with an external script to fix the numbering, but I was wondering if there is something I could do from within the pipeline. I haven't seen attributes on p:directory-list that would help with that.




XPath 3.1 has fn:sort you could use on e.g. <p:for-each><p:with-input select="//*:file => sort('http://www.w3.org/2013/collation/UCA?numeric=yes')"/> that processes the result of the p:directory-list.

Thanks, for the suggestion. I've tried that. But it doesn't seem to have any effect. It keeps processing the files in the same order. What could go wrong here? How can I track that down?




I have opened an issue on MorganaXProc III, https://sourceforge.net/p/morganaxproc-iiise/tickets/178/, Achim says numeric is currently not supported as an UCA collation argument, but he will look into whether it is feasible implementing it.



Thanks, Martin!



On the other hand, Norm has released the first XML Calabash 3 tonight and I have checked that the suggestion with the UCA numeric collation argument above (corrected to <p:with-input select="//*:file => sort('http://www.w3.org/2013/collation/UCA?numeric=yes', function($f) { $f!@name })"/> to sort on the name attribute of a file element) works with XML Calabash.



Oh, that's great to hear.



Best,

Denis

Received on Tuesday, 26 November 2024 13:46:44 UTC