- From: David Birnbaum <djbpitt@gmail.com>
- Date: Thu, 21 Nov 2024 10:21:14 -0500
- To: denis.maier@unibe.ch
- Cc: martin.honnen@gmx.de, xproc-dev@w3.org
- Message-ID: <CAP4v81qpkrkSp5+TON9hCOvSY7MO213oATMYKtE6essrmhG4cw@mail.gmail.com>
Dear All, The XPath 3.1 sort() function has a @key attribute where you can create your own function as a sort key. I haven't tried it, but if I've understood the spec correctly, you can write a function that sorts by just the numeric portion of the filename. Best, David On Thu, Nov 21, 2024 at 10:16 AM <denis.maier@unibe.ch> wrote: > *Von:* Martin Honnen <martin.honnen@gmx.de> > *Gesendet:* Donnerstag, 21. November 2024 15:56 > *An:* xproc-dev@w3.org > *Betreff:* Re: Sort directory-list > > > > Sie erhalten nicht häufig E-Mails von martin.honnen@gmx.de. Erfahren Sie, > warum dies wichtig ist <https://aka.ms/LearnAboutSenderIdentification> > > > > On 21/11/2024 15:43, 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? > > > > Best, > > Denis >
Received on Thursday, 21 November 2024 15:21:31 UTC