Re: [xsl] I desire this function: substring-before(string, regex charset)

Subject: Re: [xsl] I desire this function: substring-before(string, regex charset)
From: "Joel Kalvesmaki director@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Apr 2025 00:06:40 -0000
Hi Roger,

I desire this function: substring-before(string, regex charset)

It's a shame that the value of $arg2 can't be a regex character set, e.g.,

You desire it, and guess what, contrary to your assertion, $arg2 *can* be a regex character. Just put the function together yourself, along lines suggested by other respondents. You're in a great position with the XQuery/XPath/XSLT stack because you can make your own functions, and your imagination is the limit. The standard function library is like a set of Lego bricks. It's up to you to dream away, and snap the functions together to build your creations.


For example, there have been cases where I want normalize-space() not to trim space on the front and end, but to reduce it to a single space. Rather than complain that normalize-space() doesn't behave the way I wish it would, I can write that function myself, package it as myfunct:normalize-space(), and carry on.

Best wishes,

Joel
--
Joel Kalvesmaki
Text Alignment Network
http://textalign.net

Current Thread