[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: XPath expression to convert XSD enumerations into
Wendell, don't be reckless. Be mindful of my diabetes. But yes, it's a
tasty morsel.
On 08.07.2022 14:35, Wendell Piez wapiez@xxxxxxxxxxxxxxx wrote:
Even sweeter and more sugary
let $backward := function($s) { - string-length($s) }
return /*/xs:restriction/xs:enumeration/@value => sort((), $backward) =>
string-join('|')
Not to everyone's taste, for sure.
Cheers, Wendell
On Fri, Jul 8, 2022 at 6:34 AM Martin Honnen martin.honnen@xxxxxx
<mailto:martin.honnen@xxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx
<mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> wrote:
Am 08.07.2022 um 12:23 schrieb Roger L Costello costello@xxxxxxxxx
<mailto:costello@xxxxxxxxx>:
>> At this point we're stuck because the requirements aren't clear.
>> In the example, 12 appeared in the output before 11, but we
>> don't know why: there was nothing in the requirements
>> statement that said it should.
>
> The only requirement is for the longer strings to come first.
>
> So any of these results would be fine:
>
> 12|11|10|9|8|7|6|5|4|3|2|1
> 11|12|10|9|8|7|6|5|4|3|2|1
> 10|11|12|9|8|7|6|5|4|3|2|1
> 12|11|10|1|2|3|4|5|6|7|8|9
> ...
>
> What is the simplest XPath expression to achieve that result?
As I indicated earlier, if you know => as an operator you might consider
the following simpler:
xs:restriction/xs:enumeration/@value/string()
=> sort((), function($s) { -string-length($s) })
=> string-join('|')
But in the end its syntactic sugar.
--
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez. <http://github.com/wendellpiez.>..
...gitlab.coko.foundation/wendell...
XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/225679>
(by email <>)
--
Gerrit Imsieke
GeschC$ftsfC<hrer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de
Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930
GeschC$ftsfC<hrer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|