Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sort key option to p:text-sort #197

Closed
eriksiegel opened this issue Aug 26, 2019 · 3 comments · Fixed by #198

Comments

@eriksiegel
Copy link
Contributor

commented Aug 26, 2019

@xml-project pointed out that the stable option on p:text-sort does not makes sense as it is specified. Lines are either the same or not.

What we can do is add an option that defines a sort key as an XPath expression on the step. Proposal: select. This expression would act on every line (so you can do things like substring(., 1, 3) to sort on the first three characters). I think this is very useful and stable will again make sense.

@ndw

This comment has been minimized.

Copy link
Collaborator

commented Aug 26, 2019

👍

@xml-project

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

👍
I we do this, I am not sure, @data-Type is still necessary.

@ndw

This comment has been minimized.

Copy link
Collaborator

commented Aug 26, 2019

That's an interesting point. I agree, if you want to sort numerically (or, for example, if you want to sort a bunch of date times), you can use select:

select="xs:integer(.)"

or

select="xs:dateTime(substring(., 1, 10))"

It might be worth noting that this can raise a runtime exception if the cast fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.