Subject: Re: [xsl] I desire this function: substring-before(string, regex charset) From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 13 Apr 2025 14:10:04 -0000 |
And, of course, the second function would just move the character class into the non-greedy search:
B replace('THEN THE CURTAIN','(^.*?[AEIOU]).*$','$1')
... returns "THE".
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" B version="3.0" B xmlns:xs="http://www.w3.org/2001/XMLSchema" B xmlns:mf="http://example.com/mf" B exclude-result-prefixes="#all">
B <xsl:function name="mf:extract" as="xs:string*"> B B B <xsl:param name="input" as="xs:string"/> B B B <xsl:variable name="match" select="replace($input,'(^.*?[AEIOU]).*$','$1')"/> B B B <xsl:sequence B B B B B select="if ($input) B B B B B B B B B B B B B then ($input, mf:extract(substring-after($input, $match))) B B B B B B B B B B B B B else ()"/> B </xsl:function>
B <xsl:template match="/" name="xsl:initial-template"> B B B <xsl:sequence select="mf:extract($input)"/> B </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] I desire this function: s, Martin Honnen martin | Thread | Re: [xsl] I desire this function: s, Dimitre Novatchev dn |
Re: [xsl] I desire this function: s, Martin Honnen martin | Date | Re: [xsl] I desire this function: s, Dimitre Novatchev dn |
Month |